tl.lin.data.array
Class ArrayListOfIntsWritable

java.lang.Object
  extended by tl.lin.data.array.ArrayListOfInts
      extended by tl.lin.data.array.ArrayListOfIntsWritable
All Implemented Interfaces:
Cloneable, Comparable<ArrayListOfIntsWritable>, Iterable<Integer>, RandomAccess, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<ArrayListOfIntsWritable>

public class ArrayListOfIntsWritable
extends ArrayListOfInts
implements org.apache.hadoop.io.WritableComparable<ArrayListOfIntsWritable>

Writable extension of the ArrayListOfInts class. This class provides an efficient data structure to store a list of ints for MapReduce jobs.


Field Summary
 
Fields inherited from class tl.lin.data.array.ArrayListOfInts
array, size
 
Constructor Summary
ArrayListOfIntsWritable()
          Constructs an ArrayListOfIntsWritable object.
ArrayListOfIntsWritable(ArrayListOfIntsWritable other)
          Constructs a deep copy of the ArrayListOfIntsWritable object given as parameter.
ArrayListOfIntsWritable(int initialCapacity)
          Constructs an empty list with the specified initial capacity.
ArrayListOfIntsWritable(int[] arr)
          Constructs a list from an array.
ArrayListOfIntsWritable(int first, int last)
          Constructs a list populated with shorts in range [first, last).
 
Method Summary
 int compareTo(ArrayListOfIntsWritable obj)
          Elementwise comparison.
static ArrayListOfIntsWritable fromArrayListOfInts(ArrayListOfInts a)
          Creates a Writable version of this list.
 void readFields(DataInput in)
          Deserializes this object.
 String toString()
           
 void write(DataOutput out)
          Serializes this object.
 
Methods inherited from class tl.lin.data.array.ArrayListOfInts
add, add, addUnique, clear, clone, contains, ensureCapacity, equals, get, getArray, indexOf, intersection, isEmpty, iterator, lastIndexOf, merge, mergeNoDuplicates, remove, set, setSize, shiftLastNToTop, size, sort, subList, toString, trimToSize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ArrayListOfIntsWritable

public ArrayListOfIntsWritable()
Constructs an ArrayListOfIntsWritable object.


ArrayListOfIntsWritable

public ArrayListOfIntsWritable(int initialCapacity)
Constructs an empty list with the specified initial capacity.

Parameters:
initialCapacity - the initial capacity of the list

ArrayListOfIntsWritable

public ArrayListOfIntsWritable(int first,
                               int last)
Constructs a list populated with shorts in range [first, last).

Parameters:
first - the smallest short in the range (inclusive)
last - the largest short in the range (exclusive)

ArrayListOfIntsWritable

public ArrayListOfIntsWritable(ArrayListOfIntsWritable other)
Constructs a deep copy of the ArrayListOfIntsWritable object given as parameter.

Parameters:
other - object to be copied

ArrayListOfIntsWritable

public ArrayListOfIntsWritable(int[] arr)
Constructs a list from an array. Defensively makes a copy of the array.

Parameters:
arr - source array
Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Deserializes this object.

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 object.

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

toString

public String toString()
Overrides:
toString in class ArrayListOfInts

fromArrayListOfInts

public static ArrayListOfIntsWritable fromArrayListOfInts(ArrayListOfInts a)
Creates a Writable version of this list.


compareTo

public int compareTo(ArrayListOfIntsWritable obj)
Elementwise comparison. Shorter always comes before if it is a sublist of longer. No preference if both are empty.

Specified by:
compareTo in interface Comparable<ArrayListOfIntsWritable>
Parameters:
obj - other object this is compared against


Copyright © 2013. All Rights Reserved.