org.javimmutable.collections
Class Holders<V>

java.lang.Object
  extended by org.javimmutable.collections.Holders<V>
Type Parameters:
V -
All Implemented Interfaces:
Holder<V>

public abstract class Holders<V>
extends Object
implements Holder<V>

Provides static utility methods for constructing Holder instances.


Method Summary
static
<T> boolean
areEqual(Holder<T> a, Holder<T> b)
           
 boolean equals(Object o)
           
static
<V> Holders<V>
fromNullable(V value)
          Creates an empty Holder if value is null or a filled Holder if value is non-null.
 int hashCode()
           
static
<T> int
hashCode(Holder<T> a)
           
static
<V> Holders<V>
of()
          Creates an empty Holder for the specified type.
static
<V> Holders<V>
of(V value)
          Creates a filled Holder for the specified type and (possibly null) value.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.javimmutable.collections.Holder
getValue, getValueOr, getValueOrNull, isEmpty, isFilled
 

Method Detail

of

@Nonnull
public static <V> Holders<V> of()
Creates an empty Holder for the specified type. Shares a single instance for all empty Holders to save memory.

Type Parameters:
V -
Returns:
the Holder

of

@Nonnull
public static <V> Holders<V> of(@Nullable
                                        V value)
Creates a filled Holder for the specified type and (possibly null) value.

Type Parameters:
V -
Parameters:
value -
Returns:
the Holder

fromNullable

@Nonnull
public static <V> Holders<V> fromNullable(@Nullable
                                                  V value)
Creates an empty Holder if value is null or a filled Holder if value is non-null.

Type Parameters:
V -
Parameters:
value -
Returns:
the Holder

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

areEqual

public static <T> boolean areEqual(Holder<T> a,
                                   Holder<T> b)

hashCode

public static <T> int hashCode(Holder<T> a)


Copyright © 2014 Burton Computer Corporation. All rights reserved.