tl.lin.data.array
Class ArrayListWritableComparable<E extends org.apache.hadoop.io.WritableComparable>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<E>
              extended by tl.lin.data.array.ArrayListWritableComparable<E>
Type Parameters:
E - type of list element
All Implemented Interfaces:
Serializable, Cloneable, Comparable<ArrayListWritableComparable<E>>, Iterable<E>, Collection<E>, List<E>, RandomAccess, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<ArrayListWritableComparable<E>>

public class ArrayListWritableComparable<E extends org.apache.hadoop.io.WritableComparable>
extends ArrayList<E>
implements org.apache.hadoop.io.WritableComparable<ArrayListWritableComparable<E>>

WritableComparable extension of a Java ArrayList. Elements in the list must be homogeneous and must implement Hadoop's WritableComparable interface.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ArrayListWritableComparable()
          Creates an ArrayListWritableComparable object.
ArrayListWritableComparable(ArrayList<E> array)
          Creates an ArrayListWritableComparable object from a regular ArrayList.
 
Method Summary
 int compareTo(ArrayListWritableComparable<E> obj)
           Defines a natural sort order for the ListWritable class.
 void readFields(DataInput in)
          Deserializes the array.
 String toString()
          Generates human-readable String representation of this ArrayList.
 void write(DataOutput out)
          Serializes this array.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

ArrayListWritableComparable

public ArrayListWritableComparable()
Creates an ArrayListWritableComparable object.


ArrayListWritableComparable

public ArrayListWritableComparable(ArrayList<E> array)
Creates an ArrayListWritableComparable object from a regular ArrayList.

Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Deserializes the array.

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Parameters:
in - source for raw byte representation
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Serializes this array.

Specified by:
write in interface org.apache.hadoop.io.Writable
Parameters:
out - where to write the raw byte representation
Throws:
IOException

compareTo

public int compareTo(ArrayListWritableComparable<E> obj)

Defines a natural sort order for the ListWritable class. Following standard convention, this method returns a value less than zero, a value greater than zero, or zero if this ListWritable should be sorted before, sorted after, or is equal to obj. The sort order is defined as follows:

Specified by:
compareTo in interface Comparable<ArrayListWritableComparable<E extends org.apache.hadoop.io.WritableComparable>>
Returns:
a value less than zero, a value greater than zero, or zero if this Tuple should be sorted before, sorted after, or is equal to obj.

toString

public String toString()
Generates human-readable String representation of this ArrayList.

Overrides:
toString in class AbstractCollection<E extends org.apache.hadoop.io.WritableComparable>
Returns:
human-readable String representation of this ArrayList


Copyright © 2013. All Rights Reserved.