Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ericsson.otp.erlang
Class OtpErlangList

    java.lang.Object
      |
      +--com.ericsson.otp.erlang.OtpErlangObject
            |
            +--com.ericsson.otp.erlang.OtpErlangList

public class OtpErlangList
extends OtpErlangObject
implements java.io.Serializable, java.lang.Cloneable

Provides a Java representation of Erlang lists. Lists are created from zero or more arbitrary Erlang terms.

The arity of the list is the number of elements it contains.

See Also:
  Serialized Form

Constructor Summary
`OtpErlangList()` Create an empty list.
`OtpErlangList(OtpErlangObject elem)` Create a list containing one element.
`OtpErlangList(OtpErlangObject[] elems)` Create a list from an array of arbitrary Erlang terms.
`OtpErlangList(OtpErlangObject[] elems, int start, int count)` Create a list from an array of arbitrary Erlang terms.
`OtpErlangList(OtpInputStream buf)` Create a list from a stream containing an list encoded in Erlang external format.
`OtpErlangList(java.lang.String str)` Create a list of characters.

Method Summary
`int` | `arity()` Get the arity of the list.
`java.lang.Object` | `clone()`
`OtpErlangObject` | `elementAt(int i)` Get the specified element from the list.
`OtpErlangObject[]` | `elements()` Get all the elements from the list as an array.
`void` | `encode(OtpOutputStream buf)` Convert this list to the equivalent Erlang external representation.
`boolean` | `equals(java.lang.Object o)` Determine if two lists are equal.
`java.lang.String` | `toString()` Get the string representation of the list.

Methods inherited from class com.ericsson.otp.erlang.OtpErlangObject
`decode`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### OtpErlangList

    public OtpErlangList()

  Create an empty list.

### OtpErlangList

    public OtpErlangList(java.lang.String str)

  Create a list of characters.
  Parameters:
    `str` - the characters from which to create the list.

### OtpErlangList

    public OtpErlangList(OtpErlangObject elem)

  Create a list containing one element.
  Parameters:
    `elem` - the elememet to make the list from.

### OtpErlangList

    public OtpErlangList(OtpErlangObject[] elems)

  Create a list from an array of arbitrary Erlang terms.
  Parameters:
    `elems` - the array of terms from which to create the list.

### OtpErlangList

    public OtpErlangList(OtpErlangObject[] elems,
                         int start,
                         int count)

  Create a list from an array of arbitrary Erlang terms.
  Parameters:
    `elems` - the array of terms from which to create the list.
    `start` - the offset of the first term to insert.
    `count` - the number of terms to insert.

### OtpErlangList

    public OtpErlangList(OtpInputStream buf)
                  throws OtpErlangDecodeException

  Create a list from a stream containing an list encoded in Erlang external format.
  Parameters:
    `buf` - the stream containing the encoded list.
  Throws:
    OtpErlangDecodeException - if the buffer does not contain a valid external representation of an Erlang list.

Method Detail

### arity

    public int arity()

  Get the arity of the list.
  Returns:
    the number of elements contained in the list.

### elementAt

    public OtpErlangObject elementAt(int i)

  Get the specified element from the list.
  Parameters:
    `i` - the index of the requested element. List elements are numbered as array elements, starting at 0.
  Returns:
    the requested element, of null if i is not a valid element index.

### elements

    public OtpErlangObject[] elements()

  Get all the elements from the list as an array.
  Returns:
    an array containing all of the list's elements.

### toString

    public java.lang.String toString()

  Get the string representation of the list.
  Overrides:
    toString in class OtpErlangObject
  Returns:
    the string representation of the list.

### encode

    public void encode(OtpOutputStream buf)

  Convert this list to the equivalent Erlang external representation. Note that this method never encodes lists as strings, even when it is possible to do so.
  Overrides:
    encode in class OtpErlangObject
  Parameters:
    `buf` - An output stream to which the encoded list should be written.

### equals

    public boolean equals(java.lang.Object o)

  Determine if two lists are equal. Lists are equal if they have the same arity and all of the elements are equal.
  Overrides:
    equals in class OtpErlangObject
  Parameters:
    `o` - the list to compare to.
  Returns:
    true if the lists have the same arity and all the elements are equal.

### clone

    public java.lang.Object clone()

  Overrides:
    clone in class OtpErlangObject

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD