public final class OCamlList<T extends OCamlValue> extends OCamlValue implements java.lang.Iterable<T>
OCamlList class is the wrapper class for OCaml values of
type 'a list.WRAPPER| Modifier and Type | Method and Description |
|---|---|
static <T extends OCamlValue> |
create(java.util.List<T> v) |
static <T extends OCamlValue> |
create(T hd,
OCamlList<T> tl)
Constructs a new
'a list value. |
static <T extends OCamlValue> |
create(Wrapper<T> w)
Constructs a new
'a list value. |
static <T extends OCamlValue> |
create(Wrapper<T> w,
java.util.List<T> v)
Constructs a new
'a list value, and wraps it. |
boolean |
equals(java.lang.Object obj) |
Wrapper<? extends OCamlList<T>> |
getWrapper()
Returns the wrapper used to wrap
Value elements into
instances of the current class. |
Wrapper<? extends OCamlValue> |
getWrapper(int idx)
Returns the wrapper used to wrap
Value elements into
instances of the embedded type at given index. |
int |
hashCode() |
T |
head()
Returns the head of the list.
|
boolean |
isEmpty()
Tests whether the list is empty.
|
java.util.Iterator<T> |
iterator() |
long |
length()
Returns the list length.
|
OCamlList<T> |
tail()
Returns the tail of the list.
|
java.lang.String |
toString() |
static <T extends OCamlValue> |
wrap(Wrapper<T> w,
org.ocamljava.runtime.values.Value v)
Wraps the passed value.
|
static <T extends OCamlValue> |
wrapper(Wrapper<T> w)
Returns a wrapper for
OCamlList values. |
value, wrap, wrapperpublic Wrapper<? extends OCamlList<T>> getWrapper()
Value elements into
instances of the current class.getWrapper in class OCamlValueValue elements into
instances of the current classpublic Wrapper<? extends OCamlValue> getWrapper(int idx)
Value elements into
instances of the embedded type at given index.getWrapper in class OCamlValueidx - index of embedded typeValue elements into
instances of the embedded type at given index.public boolean isEmpty()
true if the list is empty, false otherwisepublic long length()
public T head()
null if the list is emptypublic OCamlList<T> tail()
null if the list is emptypublic java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T extends OCamlValue>public int hashCode()
hashCode in class OCamlValuepublic boolean equals(java.lang.Object obj)
equals in class OCamlValuepublic java.lang.String toString()
toString in class OCamlValuepublic static <T extends OCamlValue> OCamlList<T> create(Wrapper<T> w, java.util.List<T> v)
'a list value, and wraps it. w - wrapper for elements - should not be nullv - list to wrap - should not be nullOCamlList instance wrapping the passed valuepublic static <T extends OCamlValue> OCamlList<T> create(java.util.List<T> v)
public static <T extends OCamlValue> OCamlList<T> create(Wrapper<T> w)
'a list value.w - wrapper for elements - should not be nullOCamlList instance wrapping the empty listpublic static <T extends OCamlValue> OCamlList<T> create(T hd, OCamlList<T> tl)
'a list value.hd - list head - should not be nulltl - list tail - should not be nullOCamlList instance wrapping the empty listpublic static <T extends OCamlValue> OCamlList<T> wrap(Wrapper<T> w, org.ocamljava.runtime.values.Value v)
w - wrapper for elements - should not be nullv - value to wrap - should not be nullOCamlList instance wrapping the passed valuepublic static <T extends OCamlValue> Wrapper<? extends OCamlList<T>> wrapper(Wrapper<T> w)
OCamlList values.w - wrapper for elements - should not be nullOCamlList values