http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WBooleanCollection.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WBooleanCollection.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WBooleanCollection.java
new file mode 100644
index 0000000..7858d30
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WBooleanCollection.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections;
+
+import org.apache.giraph.function.primitive.BooleanConsumer;
+import org.apache.giraph.function.primitive.BooleanPredicate;
+import org.apache.hadoop.io.BooleanWritable;
+
+import it.unimi.dsi.fastutil.booleans.BooleanCollection;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Long specialization of WCollection
+ */
+public interface WBooleanCollection
+    extends WCollection<BooleanWritable>, BooleanCollection {
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  void forEachBoolean(BooleanConsumer f);
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  boolean forEachWhileBoolean(BooleanPredicate f);
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WByteCollection.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WByteCollection.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WByteCollection.java
new file mode 100644
index 0000000..1a67733
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WByteCollection.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections;
+
+import org.apache.giraph.function.primitive.ByteConsumer;
+import org.apache.giraph.function.primitive.BytePredicate;
+import org.apache.hadoop.io.ByteWritable;
+
+import it.unimi.dsi.fastutil.bytes.ByteCollection;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Long specialization of WCollection
+ */
+public interface WByteCollection
+    extends WCollection<ByteWritable>, ByteCollection {
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  void forEachByte(ByteConsumer f);
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  boolean forEachWhileByte(BytePredicate f);
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WCollection.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WCollection.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WCollection.java
new file mode 100644
index 0000000..9ff0b5a
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WCollection.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.giraph.function.Consumer;
+import org.apache.giraph.function.Predicate;
+import org.apache.giraph.types.ops.PrimitiveTypeOps;
+import org.apache.hadoop.io.Writable;
+
+/**
+ * Collection over mutable elements, which are probably
+ * internally stored differently/efficiently, and are accessed
+ * through methods providing "return" value.
+ *
+ * @param <T> Element type
+ */
+public interface WCollection<T> extends Writable {
+  /** Removes all of the elements from this  */
+  void clear();
+  /**
+   * Number of elements in this list
+   * @return size
+   */
+  int size();
+  /**
+   * Capacity of currently allocated memory
+   * @return capacity
+   */
+  int capacity();
+  /**
+   * Forces allocated memory to hold exactly N values
+   * @param n new capacity
+   */
+  void setCapacity(int n);
+  /**
+   * Add value to the collection
+   * @param value Value
+   */
+  void addW(T value);
+  /**
+   * TypeOps for type of elements this object holds
+   * @return TypeOps
+   */
+  PrimitiveTypeOps<T> getElementTypeOps();
+  /**
+   * Fast iterator over collection objects, which doesn't allocate new
+   * element for each returned element, and can be iterated multiple times
+   * using reset().
+   *
+   * Object returned by next() is only valid until next() is called again,
+   * because it is reused.
+   *
+   * @return RessettableIterator
+   */
+  ResettableIterator<T> fastIteratorW();
+  /**
+   * Fast iterator over collection objects, which doesn't allocate new
+   * element for each returned element, and can be iterated multiple times
+   * using reset().
+   *
+   * Each call to next() populates passed value.
+   *
+   * @param iterationValue Value that call to next() will populate
+   * @return RessettableIterator
+   */
+  ResettableIterator<T> fastIteratorW(T iterationValue);
+  /**
+   * Traverse all elements of the collection, calling given function on each
+   * element. Passed values are valid only during the call to the passed
+   * function, so data needs to be consumed during the function.
+   *
+   * @param f Function to call on each element.
+   */
+  void fastForEachW(Consumer<T> f);
+  /**
+   * Traverse all elements of the collection, calling given function on each
+   * element, or until predicate returns false.
+   * Passed values are valid only during the call to the passed
+   * function, so data needs to be consumed during the function.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  boolean fastForEachWhileW(Predicate<T> f);
+  /**
+   * Write elements to the DataOutput stream, without the size itself.
+   * Can be read back using readElements function.
+   *
+   * @param out Data output
+   */
+  void writeElements(DataOutput out) throws IOException;
+  /**
+   * Read elements from DataInput stream, with passing the size instead
+   * reading it from the stream.
+   *
+   * @param in Data Input
+   * @param size Number of elements
+   */
+  void readElements(DataInput in, int size) throws IOException;
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WDoubleCollection.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WDoubleCollection.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WDoubleCollection.java
new file mode 100644
index 0000000..1231483
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WDoubleCollection.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections;
+
+import org.apache.giraph.function.primitive.DoubleConsumer;
+import org.apache.giraph.function.primitive.DoublePredicate;
+import org.apache.hadoop.io.DoubleWritable;
+
+import it.unimi.dsi.fastutil.doubles.DoubleCollection;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Long specialization of WCollection
+ */
+public interface WDoubleCollection
+    extends WCollection<DoubleWritable>, DoubleCollection {
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  void forEachDouble(DoubleConsumer f);
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  boolean forEachWhileDouble(DoublePredicate f);
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WFloatCollection.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WFloatCollection.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WFloatCollection.java
new file mode 100644
index 0000000..1ff3cb6
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WFloatCollection.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections;
+
+import org.apache.giraph.function.primitive.FloatConsumer;
+import org.apache.giraph.function.primitive.FloatPredicate;
+import org.apache.hadoop.io.FloatWritable;
+
+import it.unimi.dsi.fastutil.floats.FloatCollection;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Long specialization of WCollection
+ */
+public interface WFloatCollection
+    extends WCollection<FloatWritable>, FloatCollection {
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  void forEachFloat(FloatConsumer f);
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  boolean forEachWhileFloat(FloatPredicate f);
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WIntCollection.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WIntCollection.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WIntCollection.java
new file mode 100644
index 0000000..cd67a56
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WIntCollection.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections;
+
+import org.apache.giraph.function.primitive.IntConsumer;
+import org.apache.giraph.function.primitive.IntPredicate;
+import org.apache.hadoop.io.IntWritable;
+
+import it.unimi.dsi.fastutil.ints.IntCollection;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Long specialization of WCollection
+ */
+public interface WIntCollection
+    extends WCollection<IntWritable>, IntCollection {
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  void forEachInt(IntConsumer f);
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  boolean forEachWhileInt(IntPredicate f);
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WLongCollection.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WLongCollection.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WLongCollection.java
new file mode 100644
index 0000000..f800add
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/WLongCollection.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections;
+
+import org.apache.giraph.function.primitive.LongConsumer;
+import org.apache.giraph.function.primitive.LongPredicate;
+import org.apache.hadoop.io.LongWritable;
+
+import it.unimi.dsi.fastutil.longs.LongCollection;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Long specialization of WCollection
+ */
+public interface WLongCollection
+    extends WCollection<LongWritable>, LongCollection {
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  void forEachLong(LongConsumer f);
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  boolean forEachWhileLong(LongPredicate f);
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WArrayList.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WArrayList.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WArrayList.java
new file mode 100644
index 0000000..0539524
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WArrayList.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections.array;
+import org.apache.giraph.types.ops.collections.WCollection;
+
+/**
+ * Array list over mutable elements, which are probably
+ * internally stored differently/efficiently, and are accessed
+ * through methods providing "return" value.
+ *
+ * @param <T> Element type
+ */
+public interface WArrayList<T> extends WCollection<T> {
+  /**
+   * Sets the size of this
+   *
+   * <P>
+   * If the specified size is smaller than the current size,
+   * the last elements are discarded.
+   * Otherwise, they are filled with 0/<code>null</code>/<code>false</code>.
+   *
+   * @param newSize the new size.
+   */
+  void size(int newSize);
+  /**
+   * Trims this array list so that the capacity is equal to the size.
+   *
+   * @see java.util.ArrayList#trimToSize()
+   */
+  void trim();
+  /**
+   * Pop value from the end of the array, storing it into 'to' argument
+   * @param to Object to store value into
+   */
+  void popIntoW(T to);
+  /**
+   * Get element at given index in the array, storing it into 'to' argument
+   * @param index Index
+   * @param to Object to store value into
+   */
+  void getIntoW(int index, T to);
+  /**
+   * Set element at given index in the array
+   * @param index Index
+   * @param value Value
+   */
+  void setW(int index, T value);
+  /**
+   * Sets given range of elements to a specified value.
+   *
+   * @param from From index (inclusive)
+   * @param to To index (exclusive)
+   * @param value Value
+   */
+  void fillW(int from, int to, T value);
+  /** Sort the array in ascending order */
+  void sort();
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WArrayListPrivateUtils.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WArrayListPrivateUtils.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WArrayListPrivateUtils.java
new file mode 100644
index 0000000..7f79ff1
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WArrayListPrivateUtils.java
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections.array;
+
+import java.util.NoSuchElementException;
+
+import org.apache.giraph.function.Consumer;
+import org.apache.giraph.function.Predicate;
+import org.apache.giraph.types.ops.collections.ResettableIterator;
+
+/**
+ * Private utilities class
+ *
+ * (needed since Java 7 has no default methods on interfaces,
+ * and we need to extend appropriate fastutil classes)
+ */
+class WArrayListPrivateUtils {
+  /** Hide constructor */
+  private WArrayListPrivateUtils() { }
+
+  /**
+   * Fast iterator over collection objects, which doesn't allocate new
+   * element for each returned element, and can be iterated multiple times
+   * using reset().
+   *
+   * Object returned by next() is only valid until next() is called again,
+   * because it is reused.
+   *
+   * @param list Collection to iterate over
+   * @param iterationValue reusable iteration value
+   * @return RessettableIterator
+   * @param <T> Element type
+   */
+  static <T> ResettableIterator<T> fastIterator(
+      final WArrayList<T> list, final T iterationValue) {
+    return new ResettableIterator<T>() {
+      private int pos;
+
+      @Override
+      public boolean hasNext() {
+        return pos < list.size();
+      }
+
+      @Override
+      public T next() {
+        if (!hasNext()) {
+          throw new NoSuchElementException();
+        }
+        list.getIntoW(pos, iterationValue);
+        pos++;
+        return iterationValue;
+      }
+
+      @Override
+      public void reset() {
+        pos = 0;
+      }
+
+      @Override
+      public void remove() {
+        throw new UnsupportedOperationException();
+      }
+    };
+  }
+
+  /**
+   * Traverse all elements of the collection, calling given function on each
+   * element. Passed values are valid only during the call to the passed
+   * function, so data needs to be consumed during the function.
+   *
+   * @param list Collection to iterate over
+   * @param f Function to call on each element.
+   * @param iterationValue reusable iteration value
+   * @param <T> Element type
+   */
+  static <T> void fastForEach(
+      WArrayList<T> list, Consumer<T> f, T iterationValue) {
+    for (int i = 0; i < list.size(); ++i) {
+      list.getIntoW(i, iterationValue);
+      f.apply(iterationValue);
+    }
+  }
+
+  /**
+   * Traverse all elements of the collection, calling given function on each
+   * element, or until predicate returns false.
+   * Passed values are valid only during the call to the passed
+   * function, so data needs to be consumed during the function.
+   *
+   * @param list Collection to iterate over
+   * @param f Function to call on each element.
+   * @param iterationValue reusable iteration value
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   * @param <T> Element type
+   */
+  static <T> boolean fastForEachWhile(
+      WArrayList<T> list, Predicate<T> f, T iterationValue) {
+    for (int i = 0; i < list.size(); ++i) {
+      list.getIntoW(i, iterationValue);
+      if (!f.apply(iterationValue)) {
+        return false;
+      }
+    }
+    return true;
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WBooleanArrayList.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WBooleanArrayList.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WBooleanArrayList.java
new file mode 100644
index 0000000..213fb56
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WBooleanArrayList.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections.array;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.giraph.function.Consumer;
+import org.apache.giraph.function.Predicate;
+import org.apache.giraph.function.primitive.BooleanConsumer;
+import org.apache.giraph.function.primitive.BooleanPredicate;
+import org.apache.giraph.types.ops.BooleanTypeOps;
+import org.apache.giraph.types.ops.PrimitiveTypeOps;
+import org.apache.giraph.types.ops.collections.ResettableIterator;
+import org.apache.giraph.types.ops.collections.WBooleanCollection;
+import org.apache.hadoop.io.BooleanWritable;
+import org.apache.giraph.utils.Varint;
+
+import it.unimi.dsi.fastutil.booleans.BooleanArrayList;
+import it.unimi.dsi.fastutil.booleans.BooleanArrays;
+import it.unimi.dsi.fastutil.booleans.BooleanCollection;
+import it.unimi.dsi.fastutil.booleans.BooleanList;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Writable extension of BooleanArrayList, as well as
+ * BooleanWritable implementation of WArrayList.
+ */
+public class WBooleanArrayList
+    extends BooleanArrayList
+    implements WArrayList<BooleanWritable>, WBooleanCollection {
+  /**
+   * Creates a new array list with {@link #DEFAULT_INITIAL_CAPACITY} capacity.
+   */
+  public WBooleanArrayList() {
+    super();
+  }
+
+  /**
+   * Creates a new array list with given capacity.
+   *
+   * @param capacity the initial capacity of the array list (may be 0).
+   */
+  public WBooleanArrayList(int capacity) {
+    super(capacity);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific
+   * collection.
+   *
+   * @param c a type-specific collection that will be used to fill the array
+   *          list.
+   */
+  public WBooleanArrayList(BooleanCollection c) {
+    super(c);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific list.
+   *
+   * @param l a type-specific list that will be used to fill the array list.
+   */
+  public WBooleanArrayList(BooleanList l) {
+    super(l);
+  }
+
+  @Override
+  public PrimitiveTypeOps<BooleanWritable> getElementTypeOps() {
+    return BooleanTypeOps.INSTANCE;
+  }
+
+  @Override
+  public int capacity() {
+    return elements().length;
+  }
+
+  @Override
+  public void setCapacity(int n) {
+    if (n >= capacity()) {
+      ensureCapacity(n);
+    } else {
+      trim(n);
+    }
+  }
+
+  @Override
+  public void addW(BooleanWritable value) {
+    add(value.get());
+  }
+
+  @Override
+  public void getIntoW(int index, BooleanWritable to) {
+    to.set(getBoolean(index));
+  }
+
+  @Override
+  public void popIntoW(BooleanWritable to) {
+    to.set(popBoolean());
+  }
+
+  @Override
+  public void setW(int index, BooleanWritable value) {
+    set(index, value.get());
+  }
+
+  @Override
+  public void fillW(int from, int to, BooleanWritable value) {
+    if (to > size()) {
+      throw new ArrayIndexOutOfBoundsException(
+          "End index (" + to + ") is greater than array length (" +
+              size() + ")");
+    }
+    Arrays.fill(elements(), from, to, value.get());
+  }
+
+  @Override
+  public ResettableIterator<BooleanWritable> fastIteratorW() {
+    return fastIteratorW(getElementTypeOps().create());
+  }
+
+  @Override
+  public ResettableIterator<BooleanWritable> fastIteratorW(
+      BooleanWritable iterationValue) {
+    return WArrayListPrivateUtils.fastIterator(this, iterationValue);
+  }
+
+  @Override
+  public void fastForEachW(Consumer<BooleanWritable> f) {
+    WArrayListPrivateUtils.fastForEach(this, f, getElementTypeOps().create());
+  }
+
+  @Override
+  public boolean fastForEachWhileW(Predicate<BooleanWritable> f) {
+    return WArrayListPrivateUtils.fastForEachWhile(
+        this, f, getElementTypeOps().create());
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  public void forEachBoolean(BooleanConsumer f) {
+    for (int i = 0; i < size(); ++i) {
+      f.apply(getBoolean(i));
+    }
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  public boolean forEachWhileBoolean(BooleanPredicate f) {
+    for (int i = 0; i < size(); ++i) {
+      if (!f.apply(getBoolean(i))) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  @Override
+  public void sort() {
+    BooleanArrays.quickSort(elements(), 0, size());
+  }
+
+  @Override
+  public void writeElements(DataOutput out) throws IOException {
+    for (int i = 0; i < size; i++) {
+      out.writeBoolean(a[i]);
+    }
+  }
+
+  @Override
+  public void write(DataOutput out) throws IOException {
+    Varint.writeUnsignedVarInt(size, out);
+    writeElements(out);
+  }
+
+  @Override
+  public void readElements(DataInput in, int size) throws IOException {
+    this.size = size;
+    resizeArrayForRead(size);
+    for (int i = 0; i < size; i++) {
+      a[i] = in.readBoolean();
+    }
+  }
+
+  /**
+   * Resize array for reading given number of elements.
+   * @param size Number of elements that will be read.
+   */
+  protected void resizeArrayForRead(int size) {
+    if (size != a.length) {
+      a = new boolean[size];
+    }
+  }
+
+  @Override
+  public void readFields(DataInput in) throws IOException {
+    readElements(in, Varint.readUnsignedVarInt(in));
+  }
+
+  /**
+   * Write a potentially null list to a DataOutput. Null list is written
+   * equivalently as an empty list. Use WritableUtils.writeIfNotNullAndObject
+   * if distinction is needed.
+   *
+   * @param list Array list to be written
+   * @param out Data output
+   */
+  public static void writeOrNull(WBooleanArrayList list, DataOutput out)
+      throws IOException {
+    if (list == null) {
+      Varint.writeUnsignedVarInt(0, out);
+    } else {
+      list.write(out);
+    }
+  }
+
+  /**
+   * Read array list from the DataInput stream into a newly created object.
+   *
+   * @param in Data input
+   * @return New read array list object.
+   */
+  public static WBooleanArrayList readNew(DataInput in) throws IOException {
+    int size = Varint.readSignedVarInt(in);
+    WBooleanArrayList list = new WBooleanArrayList(size);
+    list.readElements(in, size);
+    return list;
+  }
+
+  /**
+   * Variant of WBooleanArrayList that doesn't reallocate smaller backing
+   * array on consecutive readFields/readElements calls, and so is suitable for
+   * reusable use.
+   * (and backing array will only grow on readFields/readElements calls)
+   */
+  public static class WReusableBooleanArrayList
+      extends WBooleanArrayList {
+    /** Constructor */
+    public WReusableBooleanArrayList() {
+      super();
+    }
+
+    /**
+     * Constructor
+     * @param capacity Capacity
+     */
+    public WReusableBooleanArrayList(int capacity) {
+      super(capacity);
+    }
+
+    @Override
+    protected void resizeArrayForRead(int size) {
+      if (size > a.length) {
+        a = new boolean[size];
+      }
+    }
+
+    /**
+     * Read array list from DataInput stream, into a given list if not null,
+     * or creating a new list if given list is null.
+     *
+     * @param list Array list to be written
+     * @param in Data input
+     * @return Passed array list, or a new one if null is passed
+     */
+    public static WReusableBooleanArrayList readIntoOrCreate(
+        WReusableBooleanArrayList list, DataInput in) throws IOException {
+      int size = Varint.readUnsignedVarInt(in);
+      if (list == null) {
+        list = new WReusableBooleanArrayList(size);
+      }
+      list.readElements(in, size);
+      return list;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WByteArrayList.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WByteArrayList.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WByteArrayList.java
new file mode 100644
index 0000000..3506331
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WByteArrayList.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections.array;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.giraph.function.Consumer;
+import org.apache.giraph.function.Predicate;
+import org.apache.giraph.function.primitive.ByteConsumer;
+import org.apache.giraph.function.primitive.BytePredicate;
+import org.apache.giraph.types.ops.ByteTypeOps;
+import org.apache.giraph.types.ops.PrimitiveTypeOps;
+import org.apache.giraph.types.ops.collections.ResettableIterator;
+import org.apache.giraph.types.ops.collections.WByteCollection;
+import org.apache.hadoop.io.ByteWritable;
+import org.apache.giraph.utils.Varint;
+
+import it.unimi.dsi.fastutil.bytes.ByteArrayList;
+import it.unimi.dsi.fastutil.bytes.ByteArrays;
+import it.unimi.dsi.fastutil.bytes.ByteCollection;
+import it.unimi.dsi.fastutil.bytes.ByteList;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Writable extension of ByteArrayList, as well as
+ * ByteWritable implementation of WArrayList.
+ */
+public class WByteArrayList
+    extends ByteArrayList
+    implements WArrayList<ByteWritable>, WByteCollection {
+  /**
+   * Creates a new array list with {@link #DEFAULT_INITIAL_CAPACITY} capacity.
+   */
+  public WByteArrayList() {
+    super();
+  }
+
+  /**
+   * Creates a new array list with given capacity.
+   *
+   * @param capacity the initial capacity of the array list (may be 0).
+   */
+  public WByteArrayList(int capacity) {
+    super(capacity);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific
+   * collection.
+   *
+   * @param c a type-specific collection that will be used to fill the array
+   *          list.
+   */
+  public WByteArrayList(ByteCollection c) {
+    super(c);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific list.
+   *
+   * @param l a type-specific list that will be used to fill the array list.
+   */
+  public WByteArrayList(ByteList l) {
+    super(l);
+  }
+
+  @Override
+  public PrimitiveTypeOps<ByteWritable> getElementTypeOps() {
+    return ByteTypeOps.INSTANCE;
+  }
+
+  @Override
+  public int capacity() {
+    return elements().length;
+  }
+
+  @Override
+  public void setCapacity(int n) {
+    if (n >= capacity()) {
+      ensureCapacity(n);
+    } else {
+      trim(n);
+    }
+  }
+
+  @Override
+  public void addW(ByteWritable value) {
+    add(value.get());
+  }
+
+  @Override
+  public void getIntoW(int index, ByteWritable to) {
+    to.set(getByte(index));
+  }
+
+  @Override
+  public void popIntoW(ByteWritable to) {
+    to.set(popByte());
+  }
+
+  @Override
+  public void setW(int index, ByteWritable value) {
+    set(index, value.get());
+  }
+
+  @Override
+  public void fillW(int from, int to, ByteWritable value) {
+    if (to > size()) {
+      throw new ArrayIndexOutOfBoundsException(
+          "End index (" + to + ") is greater than array length (" +
+              size() + ")");
+    }
+    Arrays.fill(elements(), from, to, value.get());
+  }
+
+  @Override
+  public ResettableIterator<ByteWritable> fastIteratorW() {
+    return fastIteratorW(getElementTypeOps().create());
+  }
+
+  @Override
+  public ResettableIterator<ByteWritable> fastIteratorW(
+      ByteWritable iterationValue) {
+    return WArrayListPrivateUtils.fastIterator(this, iterationValue);
+  }
+
+  @Override
+  public void fastForEachW(Consumer<ByteWritable> f) {
+    WArrayListPrivateUtils.fastForEach(this, f, getElementTypeOps().create());
+  }
+
+  @Override
+  public boolean fastForEachWhileW(Predicate<ByteWritable> f) {
+    return WArrayListPrivateUtils.fastForEachWhile(
+        this, f, getElementTypeOps().create());
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  public void forEachByte(ByteConsumer f) {
+    for (int i = 0; i < size(); ++i) {
+      f.apply(getByte(i));
+    }
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  public boolean forEachWhileByte(BytePredicate f) {
+    for (int i = 0; i < size(); ++i) {
+      if (!f.apply(getByte(i))) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  @Override
+  public void sort() {
+    ByteArrays.quickSort(elements(), 0, size());
+  }
+
+  @Override
+  public void writeElements(DataOutput out) throws IOException {
+    for (int i = 0; i < size; i++) {
+      out.writeByte(a[i]);
+    }
+  }
+
+  @Override
+  public void write(DataOutput out) throws IOException {
+    Varint.writeUnsignedVarInt(size, out);
+    writeElements(out);
+  }
+
+  @Override
+  public void readElements(DataInput in, int size) throws IOException {
+    this.size = size;
+    resizeArrayForRead(size);
+    for (int i = 0; i < size; i++) {
+      a[i] = in.readByte();
+    }
+  }
+
+  /**
+   * Resize array for reading given number of elements.
+   * @param size Number of elements that will be read.
+   */
+  protected void resizeArrayForRead(int size) {
+    if (size != a.length) {
+      a = new byte[size];
+    }
+  }
+
+  @Override
+  public void readFields(DataInput in) throws IOException {
+    readElements(in, Varint.readUnsignedVarInt(in));
+  }
+
+  /**
+   * Write a potentially null list to a DataOutput. Null list is written
+   * equivalently as an empty list. Use WritableUtils.writeIfNotNullAndObject
+   * if distinction is needed.
+   *
+   * @param list Array list to be written
+   * @param out Data output
+   */
+  public static void writeOrNull(WByteArrayList list, DataOutput out)
+      throws IOException {
+    if (list == null) {
+      Varint.writeUnsignedVarInt(0, out);
+    } else {
+      list.write(out);
+    }
+  }
+
+  /**
+   * Read array list from the DataInput stream into a newly created object.
+   *
+   * @param in Data input
+   * @return New read array list object.
+   */
+  public static WByteArrayList readNew(DataInput in) throws IOException {
+    int size = Varint.readSignedVarInt(in);
+    WByteArrayList list = new WByteArrayList(size);
+    list.readElements(in, size);
+    return list;
+  }
+
+  /**
+   * Variant of WByteArrayList that doesn't reallocate smaller backing
+   * array on consecutive readFields/readElements calls, and so is suitable for
+   * reusable use.
+   * (and backing array will only grow on readFields/readElements calls)
+   */
+  public static class WReusableByteArrayList
+      extends WByteArrayList {
+    /** Constructor */
+    public WReusableByteArrayList() {
+      super();
+    }
+
+    /**
+     * Constructor
+     * @param capacity Capacity
+     */
+    public WReusableByteArrayList(int capacity) {
+      super(capacity);
+    }
+
+    @Override
+    protected void resizeArrayForRead(int size) {
+      if (size > a.length) {
+        a = new byte[size];
+      }
+    }
+
+    /**
+     * Read array list from DataInput stream, into a given list if not null,
+     * or creating a new list if given list is null.
+     *
+     * @param list Array list to be written
+     * @param in Data input
+     * @return Passed array list, or a new one if null is passed
+     */
+    public static WReusableByteArrayList readIntoOrCreate(
+        WReusableByteArrayList list, DataInput in) throws IOException {
+      int size = Varint.readUnsignedVarInt(in);
+      if (list == null) {
+        list = new WReusableByteArrayList(size);
+      }
+      list.readElements(in, size);
+      return list;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WDoubleArrayList.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WDoubleArrayList.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WDoubleArrayList.java
new file mode 100644
index 0000000..a1a19e2
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WDoubleArrayList.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections.array;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.giraph.function.Consumer;
+import org.apache.giraph.function.Predicate;
+import org.apache.giraph.function.primitive.DoubleConsumer;
+import org.apache.giraph.function.primitive.DoublePredicate;
+import org.apache.giraph.types.ops.DoubleTypeOps;
+import org.apache.giraph.types.ops.PrimitiveTypeOps;
+import org.apache.giraph.types.ops.collections.ResettableIterator;
+import org.apache.giraph.types.ops.collections.WDoubleCollection;
+import org.apache.hadoop.io.DoubleWritable;
+import org.apache.giraph.utils.Varint;
+
+import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
+import it.unimi.dsi.fastutil.doubles.DoubleArrays;
+import it.unimi.dsi.fastutil.doubles.DoubleCollection;
+import it.unimi.dsi.fastutil.doubles.DoubleList;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Writable extension of DoubleArrayList, as well as
+ * DoubleWritable implementation of WArrayList.
+ */
+public class WDoubleArrayList
+    extends DoubleArrayList
+    implements WArrayList<DoubleWritable>, WDoubleCollection {
+  /**
+   * Creates a new array list with {@link #DEFAULT_INITIAL_CAPACITY} capacity.
+   */
+  public WDoubleArrayList() {
+    super();
+  }
+
+  /**
+   * Creates a new array list with given capacity.
+   *
+   * @param capacity the initial capacity of the array list (may be 0).
+   */
+  public WDoubleArrayList(int capacity) {
+    super(capacity);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific
+   * collection.
+   *
+   * @param c a type-specific collection that will be used to fill the array
+   *          list.
+   */
+  public WDoubleArrayList(DoubleCollection c) {
+    super(c);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific list.
+   *
+   * @param l a type-specific list that will be used to fill the array list.
+   */
+  public WDoubleArrayList(DoubleList l) {
+    super(l);
+  }
+
+  @Override
+  public PrimitiveTypeOps<DoubleWritable> getElementTypeOps() {
+    return DoubleTypeOps.INSTANCE;
+  }
+
+  @Override
+  public int capacity() {
+    return elements().length;
+  }
+
+  @Override
+  public void setCapacity(int n) {
+    if (n >= capacity()) {
+      ensureCapacity(n);
+    } else {
+      trim(n);
+    }
+  }
+
+  @Override
+  public void addW(DoubleWritable value) {
+    add(value.get());
+  }
+
+  @Override
+  public void getIntoW(int index, DoubleWritable to) {
+    to.set(getDouble(index));
+  }
+
+  @Override
+  public void popIntoW(DoubleWritable to) {
+    to.set(popDouble());
+  }
+
+  @Override
+  public void setW(int index, DoubleWritable value) {
+    set(index, value.get());
+  }
+
+  @Override
+  public void fillW(int from, int to, DoubleWritable value) {
+    if (to > size()) {
+      throw new ArrayIndexOutOfBoundsException(
+          "End index (" + to + ") is greater than array length (" +
+              size() + ")");
+    }
+    Arrays.fill(elements(), from, to, value.get());
+  }
+
+  @Override
+  public ResettableIterator<DoubleWritable> fastIteratorW() {
+    return fastIteratorW(getElementTypeOps().create());
+  }
+
+  @Override
+  public ResettableIterator<DoubleWritable> fastIteratorW(
+      DoubleWritable iterationValue) {
+    return WArrayListPrivateUtils.fastIterator(this, iterationValue);
+  }
+
+  @Override
+  public void fastForEachW(Consumer<DoubleWritable> f) {
+    WArrayListPrivateUtils.fastForEach(this, f, getElementTypeOps().create());
+  }
+
+  @Override
+  public boolean fastForEachWhileW(Predicate<DoubleWritable> f) {
+    return WArrayListPrivateUtils.fastForEachWhile(
+        this, f, getElementTypeOps().create());
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  public void forEachDouble(DoubleConsumer f) {
+    for (int i = 0; i < size(); ++i) {
+      f.apply(getDouble(i));
+    }
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  public boolean forEachWhileDouble(DoublePredicate f) {
+    for (int i = 0; i < size(); ++i) {
+      if (!f.apply(getDouble(i))) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  @Override
+  public void sort() {
+    DoubleArrays.quickSort(elements(), 0, size());
+  }
+
+  @Override
+  public void writeElements(DataOutput out) throws IOException {
+    for (int i = 0; i < size; i++) {
+      out.writeDouble(a[i]);
+    }
+  }
+
+  @Override
+  public void write(DataOutput out) throws IOException {
+    Varint.writeUnsignedVarInt(size, out);
+    writeElements(out);
+  }
+
+  @Override
+  public void readElements(DataInput in, int size) throws IOException {
+    this.size = size;
+    resizeArrayForRead(size);
+    for (int i = 0; i < size; i++) {
+      a[i] = in.readDouble();
+    }
+  }
+
+  /**
+   * Resize array for reading given number of elements.
+   * @param size Number of elements that will be read.
+   */
+  protected void resizeArrayForRead(int size) {
+    if (size != a.length) {
+      a = new double[size];
+    }
+  }
+
+  @Override
+  public void readFields(DataInput in) throws IOException {
+    readElements(in, Varint.readUnsignedVarInt(in));
+  }
+
+  /**
+   * Write a potentially null list to a DataOutput. Null list is written
+   * equivalently as an empty list. Use WritableUtils.writeIfNotNullAndObject
+   * if distinction is needed.
+   *
+   * @param list Array list to be written
+   * @param out Data output
+   */
+  public static void writeOrNull(WDoubleArrayList list, DataOutput out)
+      throws IOException {
+    if (list == null) {
+      Varint.writeUnsignedVarInt(0, out);
+    } else {
+      list.write(out);
+    }
+  }
+
+  /**
+   * Read array list from the DataInput stream into a newly created object.
+   *
+   * @param in Data input
+   * @return New read array list object.
+   */
+  public static WDoubleArrayList readNew(DataInput in) throws IOException {
+    int size = Varint.readSignedVarInt(in);
+    WDoubleArrayList list = new WDoubleArrayList(size);
+    list.readElements(in, size);
+    return list;
+  }
+
+  /**
+   * Variant of WDoubleArrayList that doesn't reallocate smaller backing
+   * array on consecutive readFields/readElements calls, and so is suitable for
+   * reusable use.
+   * (and backing array will only grow on readFields/readElements calls)
+   */
+  public static class WReusableDoubleArrayList
+      extends WDoubleArrayList {
+    /** Constructor */
+    public WReusableDoubleArrayList() {
+      super();
+    }
+
+    /**
+     * Constructor
+     * @param capacity Capacity
+     */
+    public WReusableDoubleArrayList(int capacity) {
+      super(capacity);
+    }
+
+    @Override
+    protected void resizeArrayForRead(int size) {
+      if (size > a.length) {
+        a = new double[size];
+      }
+    }
+
+    /**
+     * Read array list from DataInput stream, into a given list if not null,
+     * or creating a new list if given list is null.
+     *
+     * @param list Array list to be written
+     * @param in Data input
+     * @return Passed array list, or a new one if null is passed
+     */
+    public static WReusableDoubleArrayList readIntoOrCreate(
+        WReusableDoubleArrayList list, DataInput in) throws IOException {
+      int size = Varint.readUnsignedVarInt(in);
+      if (list == null) {
+        list = new WReusableDoubleArrayList(size);
+      }
+      list.readElements(in, size);
+      return list;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WFloatArrayList.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WFloatArrayList.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WFloatArrayList.java
new file mode 100644
index 0000000..34e6a50
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WFloatArrayList.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections.array;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.giraph.function.Consumer;
+import org.apache.giraph.function.Predicate;
+import org.apache.giraph.function.primitive.FloatConsumer;
+import org.apache.giraph.function.primitive.FloatPredicate;
+import org.apache.giraph.types.ops.FloatTypeOps;
+import org.apache.giraph.types.ops.PrimitiveTypeOps;
+import org.apache.giraph.types.ops.collections.ResettableIterator;
+import org.apache.giraph.types.ops.collections.WFloatCollection;
+import org.apache.hadoop.io.FloatWritable;
+import org.apache.giraph.utils.Varint;
+
+import it.unimi.dsi.fastutil.floats.FloatArrayList;
+import it.unimi.dsi.fastutil.floats.FloatArrays;
+import it.unimi.dsi.fastutil.floats.FloatCollection;
+import it.unimi.dsi.fastutil.floats.FloatList;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Writable extension of FloatArrayList, as well as
+ * FloatWritable implementation of WArrayList.
+ */
+public class WFloatArrayList
+    extends FloatArrayList
+    implements WArrayList<FloatWritable>, WFloatCollection {
+  /**
+   * Creates a new array list with {@link #DEFAULT_INITIAL_CAPACITY} capacity.
+   */
+  public WFloatArrayList() {
+    super();
+  }
+
+  /**
+   * Creates a new array list with given capacity.
+   *
+   * @param capacity the initial capacity of the array list (may be 0).
+   */
+  public WFloatArrayList(int capacity) {
+    super(capacity);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific
+   * collection.
+   *
+   * @param c a type-specific collection that will be used to fill the array
+   *          list.
+   */
+  public WFloatArrayList(FloatCollection c) {
+    super(c);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific list.
+   *
+   * @param l a type-specific list that will be used to fill the array list.
+   */
+  public WFloatArrayList(FloatList l) {
+    super(l);
+  }
+
+  @Override
+  public PrimitiveTypeOps<FloatWritable> getElementTypeOps() {
+    return FloatTypeOps.INSTANCE;
+  }
+
+  @Override
+  public int capacity() {
+    return elements().length;
+  }
+
+  @Override
+  public void setCapacity(int n) {
+    if (n >= capacity()) {
+      ensureCapacity(n);
+    } else {
+      trim(n);
+    }
+  }
+
+  @Override
+  public void addW(FloatWritable value) {
+    add(value.get());
+  }
+
+  @Override
+  public void getIntoW(int index, FloatWritable to) {
+    to.set(getFloat(index));
+  }
+
+  @Override
+  public void popIntoW(FloatWritable to) {
+    to.set(popFloat());
+  }
+
+  @Override
+  public void setW(int index, FloatWritable value) {
+    set(index, value.get());
+  }
+
+  @Override
+  public void fillW(int from, int to, FloatWritable value) {
+    if (to > size()) {
+      throw new ArrayIndexOutOfBoundsException(
+          "End index (" + to + ") is greater than array length (" +
+              size() + ")");
+    }
+    Arrays.fill(elements(), from, to, value.get());
+  }
+
+  @Override
+  public ResettableIterator<FloatWritable> fastIteratorW() {
+    return fastIteratorW(getElementTypeOps().create());
+  }
+
+  @Override
+  public ResettableIterator<FloatWritable> fastIteratorW(
+      FloatWritable iterationValue) {
+    return WArrayListPrivateUtils.fastIterator(this, iterationValue);
+  }
+
+  @Override
+  public void fastForEachW(Consumer<FloatWritable> f) {
+    WArrayListPrivateUtils.fastForEach(this, f, getElementTypeOps().create());
+  }
+
+  @Override
+  public boolean fastForEachWhileW(Predicate<FloatWritable> f) {
+    return WArrayListPrivateUtils.fastForEachWhile(
+        this, f, getElementTypeOps().create());
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  public void forEachFloat(FloatConsumer f) {
+    for (int i = 0; i < size(); ++i) {
+      f.apply(getFloat(i));
+    }
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  public boolean forEachWhileFloat(FloatPredicate f) {
+    for (int i = 0; i < size(); ++i) {
+      if (!f.apply(getFloat(i))) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  @Override
+  public void sort() {
+    FloatArrays.quickSort(elements(), 0, size());
+  }
+
+  @Override
+  public void writeElements(DataOutput out) throws IOException {
+    for (int i = 0; i < size; i++) {
+      out.writeFloat(a[i]);
+    }
+  }
+
+  @Override
+  public void write(DataOutput out) throws IOException {
+    Varint.writeUnsignedVarInt(size, out);
+    writeElements(out);
+  }
+
+  @Override
+  public void readElements(DataInput in, int size) throws IOException {
+    this.size = size;
+    resizeArrayForRead(size);
+    for (int i = 0; i < size; i++) {
+      a[i] = in.readFloat();
+    }
+  }
+
+  /**
+   * Resize array for reading given number of elements.
+   * @param size Number of elements that will be read.
+   */
+  protected void resizeArrayForRead(int size) {
+    if (size != a.length) {
+      a = new float[size];
+    }
+  }
+
+  @Override
+  public void readFields(DataInput in) throws IOException {
+    readElements(in, Varint.readUnsignedVarInt(in));
+  }
+
+  /**
+   * Write a potentially null list to a DataOutput. Null list is written
+   * equivalently as an empty list. Use WritableUtils.writeIfNotNullAndObject
+   * if distinction is needed.
+   *
+   * @param list Array list to be written
+   * @param out Data output
+   */
+  public static void writeOrNull(WFloatArrayList list, DataOutput out)
+      throws IOException {
+    if (list == null) {
+      Varint.writeUnsignedVarInt(0, out);
+    } else {
+      list.write(out);
+    }
+  }
+
+  /**
+   * Read array list from the DataInput stream into a newly created object.
+   *
+   * @param in Data input
+   * @return New read array list object.
+   */
+  public static WFloatArrayList readNew(DataInput in) throws IOException {
+    int size = Varint.readSignedVarInt(in);
+    WFloatArrayList list = new WFloatArrayList(size);
+    list.readElements(in, size);
+    return list;
+  }
+
+  /**
+   * Variant of WFloatArrayList that doesn't reallocate smaller backing
+   * array on consecutive readFields/readElements calls, and so is suitable for
+   * reusable use.
+   * (and backing array will only grow on readFields/readElements calls)
+   */
+  public static class WReusableFloatArrayList
+      extends WFloatArrayList {
+    /** Constructor */
+    public WReusableFloatArrayList() {
+      super();
+    }
+
+    /**
+     * Constructor
+     * @param capacity Capacity
+     */
+    public WReusableFloatArrayList(int capacity) {
+      super(capacity);
+    }
+
+    @Override
+    protected void resizeArrayForRead(int size) {
+      if (size > a.length) {
+        a = new float[size];
+      }
+    }
+
+    /**
+     * Read array list from DataInput stream, into a given list if not null,
+     * or creating a new list if given list is null.
+     *
+     * @param list Array list to be written
+     * @param in Data input
+     * @return Passed array list, or a new one if null is passed
+     */
+    public static WReusableFloatArrayList readIntoOrCreate(
+        WReusableFloatArrayList list, DataInput in) throws IOException {
+      int size = Varint.readUnsignedVarInt(in);
+      if (list == null) {
+        list = new WReusableFloatArrayList(size);
+      }
+      list.readElements(in, size);
+      return list;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WIntArrayList.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WIntArrayList.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WIntArrayList.java
new file mode 100644
index 0000000..1e35802
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WIntArrayList.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections.array;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.giraph.function.Consumer;
+import org.apache.giraph.function.Predicate;
+import org.apache.giraph.function.primitive.IntConsumer;
+import org.apache.giraph.function.primitive.IntPredicate;
+import org.apache.giraph.types.ops.IntTypeOps;
+import org.apache.giraph.types.ops.PrimitiveTypeOps;
+import org.apache.giraph.types.ops.collections.ResettableIterator;
+import org.apache.giraph.types.ops.collections.WIntCollection;
+import org.apache.hadoop.io.IntWritable;
+import org.apache.giraph.utils.Varint;
+
+import it.unimi.dsi.fastutil.ints.IntArrayList;
+import it.unimi.dsi.fastutil.ints.IntArrays;
+import it.unimi.dsi.fastutil.ints.IntCollection;
+import it.unimi.dsi.fastutil.ints.IntList;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Writable extension of IntArrayList, as well as
+ * IntWritable implementation of WArrayList.
+ */
+public class WIntArrayList
+    extends IntArrayList
+    implements WArrayList<IntWritable>, WIntCollection {
+  /**
+   * Creates a new array list with {@link #DEFAULT_INITIAL_CAPACITY} capacity.
+   */
+  public WIntArrayList() {
+    super();
+  }
+
+  /**
+   * Creates a new array list with given capacity.
+   *
+   * @param capacity the initial capacity of the array list (may be 0).
+   */
+  public WIntArrayList(int capacity) {
+    super(capacity);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific
+   * collection.
+   *
+   * @param c a type-specific collection that will be used to fill the array
+   *          list.
+   */
+  public WIntArrayList(IntCollection c) {
+    super(c);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific list.
+   *
+   * @param l a type-specific list that will be used to fill the array list.
+   */
+  public WIntArrayList(IntList l) {
+    super(l);
+  }
+
+  @Override
+  public PrimitiveTypeOps<IntWritable> getElementTypeOps() {
+    return IntTypeOps.INSTANCE;
+  }
+
+  @Override
+  public int capacity() {
+    return elements().length;
+  }
+
+  @Override
+  public void setCapacity(int n) {
+    if (n >= capacity()) {
+      ensureCapacity(n);
+    } else {
+      trim(n);
+    }
+  }
+
+  @Override
+  public void addW(IntWritable value) {
+    add(value.get());
+  }
+
+  @Override
+  public void getIntoW(int index, IntWritable to) {
+    to.set(getInt(index));
+  }
+
+  @Override
+  public void popIntoW(IntWritable to) {
+    to.set(popInt());
+  }
+
+  @Override
+  public void setW(int index, IntWritable value) {
+    set(index, value.get());
+  }
+
+  @Override
+  public void fillW(int from, int to, IntWritable value) {
+    if (to > size()) {
+      throw new ArrayIndexOutOfBoundsException(
+          "End index (" + to + ") is greater than array length (" +
+              size() + ")");
+    }
+    Arrays.fill(elements(), from, to, value.get());
+  }
+
+  @Override
+  public ResettableIterator<IntWritable> fastIteratorW() {
+    return fastIteratorW(getElementTypeOps().create());
+  }
+
+  @Override
+  public ResettableIterator<IntWritable> fastIteratorW(
+      IntWritable iterationValue) {
+    return WArrayListPrivateUtils.fastIterator(this, iterationValue);
+  }
+
+  @Override
+  public void fastForEachW(Consumer<IntWritable> f) {
+    WArrayListPrivateUtils.fastForEach(this, f, getElementTypeOps().create());
+  }
+
+  @Override
+  public boolean fastForEachWhileW(Predicate<IntWritable> f) {
+    return WArrayListPrivateUtils.fastForEachWhile(
+        this, f, getElementTypeOps().create());
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  public void forEachInt(IntConsumer f) {
+    for (int i = 0; i < size(); ++i) {
+      f.apply(getInt(i));
+    }
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  public boolean forEachWhileInt(IntPredicate f) {
+    for (int i = 0; i < size(); ++i) {
+      if (!f.apply(getInt(i))) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  @Override
+  public void sort() {
+    IntArrays.quickSort(elements(), 0, size());
+  }
+
+  @Override
+  public void writeElements(DataOutput out) throws IOException {
+    for (int i = 0; i < size; i++) {
+      out.writeInt(a[i]);
+    }
+  }
+
+  @Override
+  public void write(DataOutput out) throws IOException {
+    Varint.writeUnsignedVarInt(size, out);
+    writeElements(out);
+  }
+
+  @Override
+  public void readElements(DataInput in, int size) throws IOException {
+    this.size = size;
+    resizeArrayForRead(size);
+    for (int i = 0; i < size; i++) {
+      a[i] = in.readInt();
+    }
+  }
+
+  /**
+   * Resize array for reading given number of elements.
+   * @param size Number of elements that will be read.
+   */
+  protected void resizeArrayForRead(int size) {
+    if (size != a.length) {
+      a = new int[size];
+    }
+  }
+
+  @Override
+  public void readFields(DataInput in) throws IOException {
+    readElements(in, Varint.readUnsignedVarInt(in));
+  }
+
+  /**
+   * Write a potentially null list to a DataOutput. Null list is written
+   * equivalently as an empty list. Use WritableUtils.writeIfNotNullAndObject
+   * if distinction is needed.
+   *
+   * @param list Array list to be written
+   * @param out Data output
+   */
+  public static void writeOrNull(WIntArrayList list, DataOutput out)
+      throws IOException {
+    if (list == null) {
+      Varint.writeUnsignedVarInt(0, out);
+    } else {
+      list.write(out);
+    }
+  }
+
+  /**
+   * Read array list from the DataInput stream into a newly created object.
+   *
+   * @param in Data input
+   * @return New read array list object.
+   */
+  public static WIntArrayList readNew(DataInput in) throws IOException {
+    int size = Varint.readSignedVarInt(in);
+    WIntArrayList list = new WIntArrayList(size);
+    list.readElements(in, size);
+    return list;
+  }
+
+  /**
+   * Variant of WIntArrayList that doesn't reallocate smaller backing
+   * array on consecutive readFields/readElements calls, and so is suitable for
+   * reusable use.
+   * (and backing array will only grow on readFields/readElements calls)
+   */
+  public static class WReusableIntArrayList
+      extends WIntArrayList {
+    /** Constructor */
+    public WReusableIntArrayList() {
+      super();
+    }
+
+    /**
+     * Constructor
+     * @param capacity Capacity
+     */
+    public WReusableIntArrayList(int capacity) {
+      super(capacity);
+    }
+
+    @Override
+    protected void resizeArrayForRead(int size) {
+      if (size > a.length) {
+        a = new int[size];
+      }
+    }
+
+    /**
+     * Read array list from DataInput stream, into a given list if not null,
+     * or creating a new list if given list is null.
+     *
+     * @param list Array list to be written
+     * @param in Data input
+     * @return Passed array list, or a new one if null is passed
+     */
+    public static WReusableIntArrayList readIntoOrCreate(
+        WReusableIntArrayList list, DataInput in) throws IOException {
+      int size = Varint.readUnsignedVarInt(in);
+      if (list == null) {
+        list = new WReusableIntArrayList(size);
+      }
+      list.readElements(in, size);
+      return list;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WLongArrayList.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WLongArrayList.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WLongArrayList.java
new file mode 100644
index 0000000..ca2ca6f
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/WLongArrayList.java
@@ -0,0 +1,305 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.giraph.types.ops.collections.array;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.giraph.function.Consumer;
+import org.apache.giraph.function.Predicate;
+import org.apache.giraph.function.primitive.LongConsumer;
+import org.apache.giraph.function.primitive.LongPredicate;
+import org.apache.giraph.types.ops.LongTypeOps;
+import org.apache.giraph.types.ops.PrimitiveTypeOps;
+import org.apache.giraph.types.ops.collections.ResettableIterator;
+import org.apache.giraph.types.ops.collections.WLongCollection;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.giraph.utils.Varint;
+
+import it.unimi.dsi.fastutil.longs.LongArrayList;
+import it.unimi.dsi.fastutil.longs.LongArrays;
+import it.unimi.dsi.fastutil.longs.LongCollection;
+import it.unimi.dsi.fastutil.longs.LongList;
+
+// AUTO-GENERATED class via class:
+// org.apache.giraph.generate.GeneratePrimitiveClasses
+
+/**
+ * Writable extension of LongArrayList, as well as
+ * LongWritable implementation of WArrayList.
+ */
+public class WLongArrayList
+    extends LongArrayList
+    implements WArrayList<LongWritable>, WLongCollection {
+  /**
+   * Creates a new array list with {@link #DEFAULT_INITIAL_CAPACITY} capacity.
+   */
+  public WLongArrayList() {
+    super();
+  }
+
+  /**
+   * Creates a new array list with given capacity.
+   *
+   * @param capacity the initial capacity of the array list (may be 0).
+   */
+  public WLongArrayList(int capacity) {
+    super(capacity);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific
+   * collection.
+   *
+   * @param c a type-specific collection that will be used to fill the array
+   *          list.
+   */
+  public WLongArrayList(LongCollection c) {
+    super(c);
+  }
+
+  /**
+   * Creates a new array list and fills it with a given type-specific list.
+   *
+   * @param l a type-specific list that will be used to fill the array list.
+   */
+  public WLongArrayList(LongList l) {
+    super(l);
+  }
+
+  @Override
+  public PrimitiveTypeOps<LongWritable> getElementTypeOps() {
+    return LongTypeOps.INSTANCE;
+  }
+
+  @Override
+  public int capacity() {
+    return elements().length;
+  }
+
+  @Override
+  public void setCapacity(int n) {
+    if (n >= capacity()) {
+      ensureCapacity(n);
+    } else {
+      trim(n);
+    }
+  }
+
+  @Override
+  public void addW(LongWritable value) {
+    add(value.get());
+  }
+
+  @Override
+  public void getIntoW(int index, LongWritable to) {
+    to.set(getLong(index));
+  }
+
+  @Override
+  public void popIntoW(LongWritable to) {
+    to.set(popLong());
+  }
+
+  @Override
+  public void setW(int index, LongWritable value) {
+    set(index, value.get());
+  }
+
+  @Override
+  public void fillW(int from, int to, LongWritable value) {
+    if (to > size()) {
+      throw new ArrayIndexOutOfBoundsException(
+          "End index (" + to + ") is greater than array length (" +
+              size() + ")");
+    }
+    Arrays.fill(elements(), from, to, value.get());
+  }
+
+  @Override
+  public ResettableIterator<LongWritable> fastIteratorW() {
+    return fastIteratorW(getElementTypeOps().create());
+  }
+
+  @Override
+  public ResettableIterator<LongWritable> fastIteratorW(
+      LongWritable iterationValue) {
+    return WArrayListPrivateUtils.fastIterator(this, iterationValue);
+  }
+
+  @Override
+  public void fastForEachW(Consumer<LongWritable> f) {
+    WArrayListPrivateUtils.fastForEach(this, f, getElementTypeOps().create());
+  }
+
+  @Override
+  public boolean fastForEachWhileW(Predicate<LongWritable> f) {
+    return WArrayListPrivateUtils.fastForEachWhile(
+        this, f, getElementTypeOps().create());
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element, or until predicate returns false.
+   *
+   * @param f Function to call on each element.
+   */
+  public void forEachLong(LongConsumer f) {
+    for (int i = 0; i < size(); ++i) {
+      f.apply(getLong(i));
+    }
+  }
+
+  /**
+   * Traverse all elements of the array list, calling given function on each
+   * element.
+   *
+   * @param f Function to call on each element.
+   * @return true if the predicate returned true for all elements,
+   *    false if it returned false for some element.
+   */
+  public boolean forEachWhileLong(LongPredicate f) {
+    for (int i = 0; i < size(); ++i) {
+      if (!f.apply(getLong(i))) {
+        return false;
+      }
+    }
+    return true;
+  }
+
+  @Override
+  public void sort() {
+    LongArrays.quickSort(elements(), 0, size());
+  }
+
+  @Override
+  public void writeElements(DataOutput out) throws IOException {
+    for (int i = 0; i < size; i++) {
+      out.writeLong(a[i]);
+    }
+  }
+
+  @Override
+  public void write(DataOutput out) throws IOException {
+    Varint.writeUnsignedVarInt(size, out);
+    writeElements(out);
+  }
+
+  @Override
+  public void readElements(DataInput in, int size) throws IOException {
+    this.size = size;
+    resizeArrayForRead(size);
+    for (int i = 0; i < size; i++) {
+      a[i] = in.readLong();
+    }
+  }
+
+  /**
+   * Resize array for reading given number of elements.
+   * @param size Number of elements that will be read.
+   */
+  protected void resizeArrayForRead(int size) {
+    if (size != a.length) {
+      a = new long[size];
+    }
+  }
+
+  @Override
+  public void readFields(DataInput in) throws IOException {
+    readElements(in, Varint.readUnsignedVarInt(in));
+  }
+
+  /**
+   * Write a potentially null list to a DataOutput. Null list is written
+   * equivalently as an empty list. Use WritableUtils.writeIfNotNullAndObject
+   * if distinction is needed.
+   *
+   * @param list Array list to be written
+   * @param out Data output
+   */
+  public static void writeOrNull(WLongArrayList list, DataOutput out)
+      throws IOException {
+    if (list == null) {
+      Varint.writeUnsignedVarInt(0, out);
+    } else {
+      list.write(out);
+    }
+  }
+
+  /**
+   * Read array list from the DataInput stream into a newly created object.
+   *
+   * @param in Data input
+   * @return New read array list object.
+   */
+  public static WLongArrayList readNew(DataInput in) throws IOException {
+    int size = Varint.readSignedVarInt(in);
+    WLongArrayList list = new WLongArrayList(size);
+    list.readElements(in, size);
+    return list;
+  }
+
+  /**
+   * Variant of WLongArrayList that doesn't reallocate smaller backing
+   * array on consecutive readFields/readElements calls, and so is suitable for
+   * reusable use.
+   * (and backing array will only grow on readFields/readElements calls)
+   */
+  public static class WReusableLongArrayList
+      extends WLongArrayList {
+    /** Constructor */
+    public WReusableLongArrayList() {
+      super();
+    }
+
+    /**
+     * Constructor
+     * @param capacity Capacity
+     */
+    public WReusableLongArrayList(int capacity) {
+      super(capacity);
+    }
+
+    @Override
+    protected void resizeArrayForRead(int size) {
+      if (size > a.length) {
+        a = new long[size];
+      }
+    }
+
+    /**
+     * Read array list from DataInput stream, into a given list if not null,
+     * or creating a new list if given list is null.
+     *
+     * @param list Array list to be written
+     * @param in Data input
+     * @return Passed array list, or a new one if null is passed
+     */
+    public static WReusableLongArrayList readIntoOrCreate(
+        WReusableLongArrayList list, DataInput in) throws IOException {
+      int size = Varint.readUnsignedVarInt(in);
+      if (list == null) {
+        list = new WReusableLongArrayList(size);
+      }
+      list.readElements(in, size);
+      return list;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/package-info.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/package-info.java
 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/package-info.java
new file mode 100644
index 0000000..7c3b8a3
--- /dev/null
+++ 
b/giraph-core/src/main/java/org/apache/giraph/types/ops/collections/array/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * WArrayList interfaces and implementations that extend fastutil
+ * classes, and are provided by TypeOps classes.
+ */
+package org.apache.giraph.types.ops.collections.array;

http://git-wip-us.apache.org/repos/asf/giraph/blob/77ae12e0/giraph-core/src/main/java/org/apache/giraph/writable/kryo/HadoopKryo.java
----------------------------------------------------------------------
diff --git 
a/giraph-core/src/main/java/org/apache/giraph/writable/kryo/HadoopKryo.java 
b/giraph-core/src/main/java/org/apache/giraph/writable/kryo/HadoopKryo.java
index 49602a1..53c8adc 100644
--- a/giraph-core/src/main/java/org/apache/giraph/writable/kryo/HadoopKryo.java
+++ b/giraph-core/src/main/java/org/apache/giraph/writable/kryo/HadoopKryo.java
@@ -28,7 +28,6 @@ import java.util.Random;
 
 import org.apache.giraph.conf.GiraphConfigurationSettable;
 import org.apache.giraph.types.ops.collections.Basic2ObjectMap;
-import org.apache.giraph.types.ops.collections.BasicArrayList;
 import org.apache.giraph.types.ops.collections.BasicSet;
 import org.apache.giraph.writable.kryo.markers.KryoIgnoreWritable;
 import org.apache.giraph.writable.kryo.markers.NonKryoWritable;
@@ -247,7 +246,7 @@ public class HadoopKryo extends Kryo {
     kryo.setInstantiatorStrategy(new DefaultInstantiatorStrategy(
         new StdInstantiatorStrategy()));
 
-    kryo.setDefaultSerializer(new SerializerFactory() {
+    SerializerFactory customSerializerFactory = new SerializerFactory() {
       @SuppressWarnings("rawtypes")
       @Override
       public Serializer makeSerializer(Kryo kryo, final Class<?> type) {
@@ -282,7 +281,6 @@ public class HadoopKryo extends Kryo {
             // remove BasicSet, BasicArrayList and Basic2ObjectMap temporarily,
             // for lack of constructors
             !BasicSet.class.isAssignableFrom(type) &&
-            !BasicArrayList.class.isAssignableFrom(type) &&
             !Basic2ObjectMap.class.isAssignableFrom(type)) {
           // use the Writable method defined by the type
           DirectWritableSerializer serializer = new DirectWritableSerializer();
@@ -293,7 +291,10 @@ public class HadoopKryo extends Kryo {
           return serializer;
         }
       }
-    });
+    };
+
+    kryo.addDefaultSerializer(Writable.class, customSerializerFactory);
+    kryo.setDefaultSerializer(customSerializerFactory);
 
     return kryo;
   }

Reply via email to