Took care of Vinayak's review comments. Cleaned up Asterix list builders.

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_tokenizer_opt@982 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/ExternalDatasetDetails.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/ExternalDatasetDetails.java
index 00e49f6..07da617 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/ExternalDatasetDetails.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/ExternalDatasetDetails.java
@@ -18,7 +18,6 @@
 import java.io.IOException;
 import java.util.Map;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.IARecordBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.builders.RecordBuilder;
@@ -65,7 +64,7 @@
     @Override
     public void writeDatasetDetailsRecordType(DataOutput out) throws HyracksDataException {
         IARecordBuilder externalRecordBuilder = new RecordBuilder();
-        IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+        OrderedListBuilder listBuilder = new OrderedListBuilder();
         ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
         externalRecordBuilder.reset(externalRecordType);
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/FeedDatasetDetails.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/FeedDatasetDetails.java
index 70f1fee..895466d 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/FeedDatasetDetails.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/FeedDatasetDetails.java
@@ -19,7 +19,6 @@
 import java.util.List;
 import java.util.Map;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.IARecordBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.builders.RecordBuilder;
@@ -71,7 +70,7 @@
     @Override
     public void writeDatasetDetailsRecordType(DataOutput out) throws HyracksDataException {
         IARecordBuilder feedRecordBuilder = new RecordBuilder();
-        IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+        OrderedListBuilder listBuilder = new OrderedListBuilder();
         ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
         feedRecordBuilder.reset(MetadataRecordTypes.FEED_DETAILS_RECORDTYPE);
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/InternalDatasetDetails.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/InternalDatasetDetails.java
index 61616c5..51d154a 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/InternalDatasetDetails.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entities/InternalDatasetDetails.java
@@ -18,7 +18,6 @@
 import java.io.IOException;
 import java.util.List;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.IARecordBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.builders.RecordBuilder;
@@ -90,7 +89,7 @@
     public void writeDatasetDetailsRecordType(DataOutput out) throws HyracksDataException {
 
         IARecordBuilder internalRecordBuilder = new RecordBuilder();
-        IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+        OrderedListBuilder listBuilder = new OrderedListBuilder();
         ArrayBackedValueStorage fieldValue = new ArrayBackedValueStorage();
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
         internalRecordBuilder.reset(MetadataRecordTypes.INTERNAL_DETAILS_RECORDTYPE);
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
index b90208c..d37fbc6 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/DatatypeTupleTranslator.java
@@ -25,7 +25,6 @@
 import java.util.Calendar;
 import java.util.List;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.IARecordBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.builders.RecordBuilder;
@@ -49,7 +48,6 @@
 import edu.uci.ics.asterix.om.types.AbstractCollectionType;
 import edu.uci.ics.asterix.om.types.BuiltinType;
 import edu.uci.ics.asterix.om.types.IAType;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
 import edu.uci.ics.hyracks.algebricks.common.exceptions.NotImplementedException;
 import edu.uci.ics.hyracks.api.dataflow.value.ISerializerDeserializer;
 import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
@@ -322,7 +320,7 @@
 
     private void writeUnionType(Datatype instance, DataOutput dataOutput) throws HyracksDataException {
         List<IAType> unionList = ((AUnionType) instance.getDatatype()).getUnionList();
-        IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+        OrderedListBuilder listBuilder = new OrderedListBuilder();
         listBuilder.reset(new AOrderedListType(BuiltinType.ASTRING, null));
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
         String typeName = null;
@@ -358,7 +356,7 @@
         IARecordBuilder fieldRecordBuilder = new RecordBuilder();
 
         ARecordType recType = (ARecordType) instance.getDatatype();
-        IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+        OrderedListBuilder listBuilder = new OrderedListBuilder();
         listBuilder.reset(new AOrderedListType(MetadataRecordTypes.FIELD_RECORDTYPE, null));
         String fieldTypeName = null;
         for (int i = 0; i < recType.getFieldNames().length; i++) {
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java
index efd62a8..8296a22 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/FunctionTupleTranslator.java
@@ -22,7 +22,6 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -140,7 +139,7 @@
         recordBuilder.addField(MetadataRecordTypes.FUNCTION_ARECORD_FUNCTION_ARITY_FIELD_INDEX, fieldValue);
 
         // write field 3
-        IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+        OrderedListBuilder listBuilder = new OrderedListBuilder();
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
         listBuilder
                 .reset((AOrderedListType) MetadataRecordTypes.FUNCTION_RECORDTYPE.getFieldTypes()[MetadataRecordTypes.FUNCTION_ARECORD_FUNCTION_PARAM_LIST_FIELD_INDEX]);
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java
index 7f723cb..d71480f 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/IndexTupleTranslator.java
@@ -23,7 +23,6 @@
 import java.util.Calendar;
 import java.util.List;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -58,7 +57,7 @@
     // Field name of open field.
     public static final String GRAM_LENGTH_FIELD_NAME = "GramLength";
 
-    private IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+    private OrderedListBuilder listBuilder = new OrderedListBuilder();
     private ArrayBackedValueStorage nameValue = new ArrayBackedValueStorage();
     private ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
     private List<String> searchKey;
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java
index 8c7645b..da66d4b 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/entitytupletranslators/NodeGroupTupleTranslator.java
@@ -23,7 +23,6 @@
 import java.util.Calendar;
 import java.util.List;
 
-import edu.uci.ics.asterix.builders.IAUnorderedListBuilder;
 import edu.uci.ics.asterix.builders.UnorderedListBuilder;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.metadata.bootstrap.MetadataPrimaryIndexes;
@@ -49,7 +48,7 @@
     // Payload field containing serialized NodeGroup.
     public static final int NODEGROUP_PAYLOAD_TUPLE_FIELD_INDEX = 1;
 
-    private IAUnorderedListBuilder listBuilder = new UnorderedListBuilder();
+    private UnorderedListBuilder listBuilder = new UnorderedListBuilder();
     private ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
     private List<String> nodeNames;
     @SuppressWarnings("unchecked")
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/AbstractListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/AbstractListBuilder.java
new file mode 100644
index 0000000..6fa2d3e
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/AbstractListBuilder.java
@@ -0,0 +1,110 @@
+package edu.uci.ics.asterix.builders;
+
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import edu.uci.ics.asterix.dataflow.data.nontagged.serde.SerializerDeserializerUtil;
+import edu.uci.ics.asterix.om.types.ATypeTag;
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
+import edu.uci.ics.hyracks.data.std.util.GrowableArray;
+import edu.uci.ics.hyracks.storage.am.common.ophelpers.IntArrayList;
+
+public abstract class AbstractListBuilder implements IAsterixListBuilder {
+
+    protected static final byte serNullTypeTag = ATypeTag.NULL.serialize();
+
+    protected final GrowableArray outputStorage;
+    protected final DataOutputStream outputStream;
+    protected final IntArrayList offsets;
+    protected int metadataInfoSize;
+    protected byte[] offsetArray;
+    protected int offsetPosition;
+    protected int headerSize;
+    protected ATypeTag itemTypeTag;
+    protected final ATypeTag listType;
+
+    protected boolean fixedSize = false;
+    protected int numberOfItems;
+
+    public AbstractListBuilder(ATypeTag listType) {
+        this.outputStorage = new GrowableArray();
+        this.outputStream = (DataOutputStream) outputStorage.getDataOutput();
+        this.offsets = new IntArrayList(10, 10);
+        this.metadataInfoSize = 0;
+        this.offsetArray = null;
+        this.offsetPosition = 0;
+        this.listType = listType;
+    }
+
+    @Override
+    public void reset(AbstractCollectionType listType) {
+        this.outputStorage.reset();
+        this.offsetArray = null;
+        this.offsets.clear();
+        this.offsetPosition = 0;
+        this.numberOfItems = 0;
+        if (listType == null || listType.getItemType() == null) {
+            this.itemTypeTag = ATypeTag.ANY;
+            fixedSize = false;
+        } else {
+            this.itemTypeTag = listType.getItemType().getTypeTag();
+            fixedSize = NonTaggedFormatUtil.isFixedSizedCollection(listType.getItemType());
+        }
+        headerSize = 2;
+        metadataInfoSize = 8;
+        // 8 = 4 (# of items) + 4 (the size of the list)
+    }
+
+    @Override
+    public void addItem(IValueReference item) throws HyracksDataException {
+        try {
+            if (!fixedSize)
+                this.offsets.add((short) outputStorage.getLength());
+            if (itemTypeTag == ATypeTag.ANY
+                    || (itemTypeTag == ATypeTag.NULL && item.getByteArray()[0] == serNullTypeTag)) {
+                this.numberOfItems++;
+                this.outputStream.write(item.getByteArray(), item.getStartOffset(), item.getLength());
+            } else if (item.getByteArray()[0] != serNullTypeTag) {
+                this.numberOfItems++;
+                this.outputStream.write(item.getByteArray(), item.getStartOffset() + 1, item.getLength() - 1);
+            }
+        } catch (IOException e) {
+            throw new HyracksDataException(e);
+        }
+    }
+
+    @Override
+    public void write(DataOutput out, boolean writeTypeTag) throws HyracksDataException {
+        try {
+            if (!fixedSize)
+                metadataInfoSize += offsets.size() * 4;
+            if (offsetArray == null || offsetArray.length < metadataInfoSize)
+                offsetArray = new byte[metadataInfoSize];
+
+            SerializerDeserializerUtil.writeIntToByteArray(offsetArray,
+                    headerSize + metadataInfoSize + outputStorage.getLength(), offsetPosition);
+            SerializerDeserializerUtil.writeIntToByteArray(offsetArray, this.numberOfItems, offsetPosition + 4);
+
+            if (!fixedSize) {
+                offsetPosition += 8;
+                for (int i = 0; i < offsets.size(); i++) {
+                    SerializerDeserializerUtil.writeIntToByteArray(offsetArray, offsets.get(i) + metadataInfoSize
+                            + headerSize, offsetPosition);
+                    offsetPosition += 4;
+                }
+            }
+            if (writeTypeTag) {
+                out.writeByte(listType.serialize());
+            }
+            out.writeByte(itemTypeTag.serialize());
+            out.write(offsetArray, 0, metadataInfoSize);
+            out.write(outputStorage.getByteArray(), 0, outputStorage.getLength());
+        } catch (IOException e) {
+            throw new HyracksDataException(e);
+        }
+    }
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAOrderedListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAOrderedListBuilder.java
deleted file mode 100644
index 0ca40a5..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAOrderedListBuilder.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package edu.uci.ics.asterix.builders;
-
-import java.io.DataOutput;
-
-import edu.uci.ics.asterix.om.types.AOrderedListType;
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.data.std.api.IValueReference;
-
-public interface IAOrderedListBuilder {
-
-    /**
-     * @param orderedlistType
-     *            - the type of the list.
-     */
-    public void reset(AOrderedListType orderedlistType) throws HyracksDataException;
-
-    /**
-     * @param item
-     *            - the item to be added to the list.
-     */
-    public void addItem(IValueReference item) throws HyracksDataException;
-
-    /**
-     * @param out
-     *            - Stream to write data to.
-     */
-    public void write(DataOutput out, boolean writeTypeTag) throws HyracksDataException;
-}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAUnorderedListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAUnorderedListBuilder.java
deleted file mode 100644
index 50d2038..0000000
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAUnorderedListBuilder.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package edu.uci.ics.asterix.builders;
-
-import java.io.DataOutput;
-
-import edu.uci.ics.asterix.om.types.AUnorderedListType;
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.data.std.api.IValueReference;
-
-public interface IAUnorderedListBuilder {
-
-    /**
-     * @param unorderedlistType
-     *            - the type of the list.
-     */
-    public void reset(AUnorderedListType unorderedlistType) throws HyracksDataException;
-
-    /**
-     * @param item
-     *            - the item to be added to the list.
-     */
-    public void addItem(IValueReference item) throws HyracksDataException;
-
-    /**
-     * @param out
-     *            - Stream to write data to.
-     */
-    public void write(DataOutput out, boolean writeTypeTag) throws HyracksDataException;
-
-}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAsterixListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAsterixListBuilder.java
new file mode 100644
index 0000000..7bab046
--- /dev/null
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/IAsterixListBuilder.java
@@ -0,0 +1,29 @@
+package edu.uci.ics.asterix.builders;
+
+import java.io.DataOutput;
+
+import edu.uci.ics.asterix.om.types.AbstractCollectionType;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
+
+public interface IAsterixListBuilder {
+    /**
+     * @param listType
+     *            Type of the list: AUnorderedListType or AOrderedListType.
+     */
+    public void reset(AbstractCollectionType listType) throws HyracksDataException;
+
+    /**
+     * @param item
+     *            Item to be added to the list.
+     */
+    public void addItem(IValueReference item) throws HyracksDataException;
+
+    /**
+     * @param out
+     *            Stream to serialize the list into.
+     * @param writeTypeTag
+     *            Whether to write the list's type tag before the list data.
+     */
+    public void write(DataOutput out, boolean writeTypeTag) throws HyracksDataException;
+}
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/OrderedListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/OrderedListBuilder.java
index 58761b4..1fdd7df 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/OrderedListBuilder.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/OrderedListBuilder.java
@@ -1,117 +1,21 @@
 package edu.uci.ics.asterix.builders;
 
-import java.io.DataOutput;
-import java.io.DataOutputStream;
 import java.io.IOException;
-import java.util.ArrayList;
 
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.SerializerDeserializerUtil;
-import edu.uci.ics.asterix.om.types.AOrderedListType;
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.data.std.api.IValueReference;
-import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 import edu.uci.ics.hyracks.storage.am.invertedindex.tokenizers.IToken;
 
-public class OrderedListBuilder implements IAOrderedListBuilder {
-
-    private ArrayBackedValueStorage outputValStorage;
-    private DataOutputStream outputStream;
-    private ArrayList<Short> offsets;
-    private int metadataInfoSize;
-    private byte[] offsetArray;
-    private int offsetPosition;
-    private int headerSize;
-    private ATypeTag itemTypeTag;
-    private byte serNullTypeTag = ATypeTag.NULL.serialize();
-    private final static byte ORDEREDLIST_TYPE_TAG = ATypeTag.ORDEREDLIST.serialize();
-
-    private boolean fixedSize = false;
-    private int numberOfItems;
+public class OrderedListBuilder extends AbstractListBuilder {
 
     public OrderedListBuilder() {
-        this.outputValStorage = new ArrayBackedValueStorage();
-        this.outputStream = (DataOutputStream) outputValStorage.getDataOutput();
-        this.offsets = new ArrayList<Short>();
-        this.metadataInfoSize = 0;
-        this.offsetArray = null;
-        this.offsetPosition = 0;
-    }
-
-    @Override
-    public void reset(AOrderedListType orderedlistType) throws HyracksDataException {
-        this.outputValStorage.reset();
-        this.offsetArray = null;
-        this.offsets.clear();
-        this.offsetPosition = 0;
-        this.numberOfItems = 0;
-        if (orderedlistType == null || orderedlistType.getItemType() == null) {
-            this.itemTypeTag = ATypeTag.ANY;
-            fixedSize = false;
-        } else {
-            this.itemTypeTag = orderedlistType.getItemType().getTypeTag();
-            fixedSize = NonTaggedFormatUtil.isFixedSizedCollection(orderedlistType.getItemType());
-        }
-        headerSize = 2;
-        metadataInfoSize = 8;
-        // 8 = 4 (# of items) + 4 (the size of the list)
-    }
-
-    @Override
-    public void addItem(IValueReference item) throws HyracksDataException {
-        try {
-            if (!fixedSize)
-                this.offsets.add((short) outputValStorage.getLength());
-            if (itemTypeTag == ATypeTag.ANY
-                    || (itemTypeTag == ATypeTag.NULL && item.getByteArray()[0] == serNullTypeTag)) {
-                this.numberOfItems++;
-                this.outputStream.write(item.getByteArray(), item.getStartOffset(), item.getLength());
-            } else if (item.getByteArray()[0] != serNullTypeTag) {
-                this.numberOfItems++;
-                this.outputStream.write(item.getByteArray(), item.getStartOffset() + 1, item.getLength() - 1);
-            }
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        super(ATypeTag.ORDEREDLIST);
     }
 
     public void addItem(IToken token) throws IOException {
         if (!fixedSize) {
-            offsets.add((short) outputValStorage.getLength());
+            offsets.add((short) outputStorage.getLength());
         }
         numberOfItems++;
-        token.serializeToken(outputValStorage);
-    }
-
-    @Override
-    public void write(DataOutput out, boolean writeTypeTag) throws HyracksDataException {
-        try {
-            if (!fixedSize)
-                metadataInfoSize += offsets.size() * 4;
-            if (offsetArray == null || offsetArray.length < metadataInfoSize)
-                offsetArray = new byte[metadataInfoSize];
-
-            SerializerDeserializerUtil.writeIntToByteArray(offsetArray, headerSize + metadataInfoSize
-                    + outputValStorage.getLength(), offsetPosition);
-            SerializerDeserializerUtil.writeIntToByteArray(offsetArray, this.numberOfItems, offsetPosition + 4);
-
-            if (!fixedSize) {
-                offsetPosition += 8;
-                for (int i = 0; i < offsets.size(); i++) {
-                    SerializerDeserializerUtil.writeIntToByteArray(offsetArray, offsets.get(i) + metadataInfoSize
-                            + headerSize, offsetPosition);
-                    offsetPosition += 4;
-                }
-            }
-            if (writeTypeTag) {
-                out.writeByte(ORDEREDLIST_TYPE_TAG);
-            }
-            out.writeByte(itemTypeTag.serialize());
-            out.write(offsetArray, 0, metadataInfoSize);
-            out.write(outputValStorage.getByteArray(), 0, outputValStorage.getLength());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        token.serializeToken(outputStorage);
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/UnorderedListBuilder.java b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/UnorderedListBuilder.java
index 90fb2b5..d1c33a4 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/builders/UnorderedListBuilder.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/builders/UnorderedListBuilder.java
@@ -1,103 +1,10 @@
 package edu.uci.ics.asterix.builders;
 
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.ArrayList;
-
-import edu.uci.ics.asterix.dataflow.data.nontagged.serde.SerializerDeserializerUtil;
 import edu.uci.ics.asterix.om.types.ATypeTag;
-import edu.uci.ics.asterix.om.types.AUnorderedListType;
-import edu.uci.ics.asterix.om.util.NonTaggedFormatUtil;
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
-import edu.uci.ics.hyracks.data.std.api.IValueReference;
 
-public class UnorderedListBuilder implements IAUnorderedListBuilder {
-
-    /**
-     * 
-     */
-    private ByteArrayOutputStream outputStream;
-    private ArrayList<Short> offsets;
-    private int metadataInfoSize;
-    private byte[] offsetArray;
-    private int offsetPosition;
-    private int headerSize;
-    private ATypeTag itemTypeTag;
-    private byte serNullTypeTag = ATypeTag.NULL.serialize();
-    private final static byte UNORDEREDLIST_TYPE_TAG = ATypeTag.UNORDEREDLIST.serialize();
-
-    private boolean fixedSize = false;
-    private int numberOfItems;
+public class UnorderedListBuilder extends AbstractListBuilder {
 
     public UnorderedListBuilder() {
-        this.outputStream = new ByteArrayOutputStream();
-        this.offsets = new ArrayList<Short>();
-        this.metadataInfoSize = 0;
-        this.offsetArray = null;
-        this.offsetPosition = 0;
-    }
-
-    @Override
-    public void reset(AUnorderedListType unorderedlistType) throws HyracksDataException {
-        this.outputStream.reset();
-        this.offsetArray = null;
-        this.offsets.clear();
-        this.offsetPosition = 0;
-        this.numberOfItems = 0;
-        if (unorderedlistType == null || unorderedlistType.getItemType() == null) {
-            this.itemTypeTag = ATypeTag.ANY;
-            fixedSize = false;
-        } else {
-            this.itemTypeTag = unorderedlistType.getItemType().getTypeTag();
-            fixedSize = NonTaggedFormatUtil.isFixedSizedCollection(unorderedlistType.getItemType());
-        }
-        headerSize = 2;
-        metadataInfoSize = 8;
-        // 8 = 4 (# of items) + 4 (the size of the list)
-    }
-
-    @Override
-    public void addItem(IValueReference item) throws HyracksDataException {
-        if (!fixedSize)
-            this.offsets.add((short) outputStream.size());
-        if (itemTypeTag == ATypeTag.ANY || (itemTypeTag == ATypeTag.NULL && item.getByteArray()[0] == serNullTypeTag)) {
-            this.numberOfItems++;
-            this.outputStream.write(item.getByteArray(), item.getStartOffset(), item.getLength());
-        } else if (item.getByteArray()[0] != serNullTypeTag) {
-            this.numberOfItems++;
-            this.outputStream.write(item.getByteArray(), item.getStartOffset() + 1, item.getLength() - 1);
-        }
-    }
-
-    @Override
-    public void write(DataOutput out, boolean writeTypeTag) throws HyracksDataException {
-        try {
-            if (!fixedSize)
-                metadataInfoSize += offsets.size() * 4;
-            if (offsetArray == null || offsetArray.length < metadataInfoSize)
-                offsetArray = new byte[metadataInfoSize];
-
-            SerializerDeserializerUtil.writeIntToByteArray(offsetArray,
-                    headerSize + metadataInfoSize + outputStream.size(), offsetPosition);
-            SerializerDeserializerUtil.writeIntToByteArray(offsetArray, this.numberOfItems, offsetPosition + 4);
-
-            if (!fixedSize) {
-                offsetPosition += 8;
-                for (int i = 0; i < offsets.size(); i++) {
-                    SerializerDeserializerUtil.writeIntToByteArray(offsetArray, offsets.get(i) + metadataInfoSize
-                            + headerSize, offsetPosition);
-                    offsetPosition += 4;
-                }
-            }
-            if (writeTypeTag) {
-                out.writeByte(UNORDEREDLIST_TYPE_TAG);
-            }
-            out.writeByte(itemTypeTag.serialize());
-            out.write(offsetArray, 0, metadataInfoSize);
-            out.write(outputStream.toByteArray(), 0, outputStream.size());
-        } catch (IOException e) {
-            throw new HyracksDataException(e);
-        }
+        super(ATypeTag.UNORDEREDLIST);
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/common/AListElementToken.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/common/AListElementToken.java
index ec4450a..df3b43e 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/common/AListElementToken.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/common/AListElementToken.java
@@ -2,7 +2,7 @@
 
 import java.io.IOException;
 
-import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
+import edu.uci.ics.hyracks.data.std.util.GrowableArray;
 import edu.uci.ics.hyracks.storage.am.invertedindex.tokenizers.IToken;
 
 public class AListElementToken implements IToken {
@@ -44,13 +44,13 @@
     }
 
     @Override
-    public void serializeToken(IMutableValueStorage outVal) throws IOException {
-        outVal.getDataOutput().writeByte(typeTag);
-        outVal.getDataOutput().write(data, start, length);
+    public void serializeToken(GrowableArray out) throws IOException {
+        out.getDataOutput().writeByte(typeTag);
+        out.getDataOutput().write(data, start, length);
     }
 
     @Override
-    public void serializeTokenCount(IMutableValueStorage outVal) throws IOException {
+    public void serializeTokenCount(GrowableArray out) throws IOException {
         throw new UnsupportedOperationException("Token count not implemented.");
     }
 }
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
index c68f82a..38262d3 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AOrderedListSerializerDeserializer.java
@@ -5,7 +5,6 @@
 import java.io.IOException;
 import java.util.ArrayList;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -91,7 +90,7 @@
     @Override
     public void serialize(AOrderedList instance, DataOutput out) throws HyracksDataException {
         // TODO: schemaless ordered list serializer
-        IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+        OrderedListBuilder listBuilder = new OrderedListBuilder();
         listBuilder.reset(orderedlistType);
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
         for (int i = 0; i < instance.size(); i++) {
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
index f295900..f85188f 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/dataflow/data/nontagged/serde/AUnorderedListSerializerDeserializer.java
@@ -5,7 +5,6 @@
 import java.io.IOException;
 import java.util.ArrayList;
 
-import edu.uci.ics.asterix.builders.IAUnorderedListBuilder;
 import edu.uci.ics.asterix.builders.UnorderedListBuilder;
 import edu.uci.ics.asterix.common.exceptions.AsterixException;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -91,7 +90,7 @@
     @Override
     public void serialize(AUnorderedList instance, DataOutput out) throws HyracksDataException {
         // TODO: schemaless ordered list serializer
-        IAUnorderedListBuilder listBuilder = new UnorderedListBuilder();
+        UnorderedListBuilder listBuilder = new UnorderedListBuilder();
         ArrayBackedValueStorage itemValue = new ArrayBackedValueStorage();
         listBuilder.reset(unorderedlistType);
         IACursor cursor = instance.getCursor();
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
index d057c88..5c928e1 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/aggregates/collections/ListifyAggregateFunctionEvalFactory.java
@@ -10,7 +10,6 @@
 import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyAggregateFunctionFactory;
 import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluator;
 import edu.uci.ics.hyracks.algebricks.runtime.base.ICopyEvaluatorFactory;
-import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
 import edu.uci.ics.hyracks.data.std.api.IDataOutputProvider;
 import edu.uci.ics.hyracks.data.std.util.ArrayBackedValueStorage;
 import edu.uci.ics.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
@@ -38,11 +37,7 @@
 
             @Override
             public void init() throws AlgebricksException {
-                try {
-                    builder.reset(orderedlistType);
-                } catch (HyracksDataException e) {
-                    throw new AlgebricksException(e);
-                }
+                builder.reset(orderedlistType);
             }
 
             @Override
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
index 68ff480..d7f87df 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/accessors/LineRectanglePolygonAccessor.java
@@ -17,7 +17,6 @@
 import java.io.DataOutput;
 import java.io.IOException;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.common.functions.FunctionConstants;
 import edu.uci.ics.asterix.dataflow.data.nontagged.Coordinate;
@@ -77,7 +76,7 @@
                     private final ArrayBackedValueStorage argOut = new ArrayBackedValueStorage();
                     private final ICopyEvaluator eval = args[0].createEvaluator(argOut);
 
-                    private final IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+                    private final OrderedListBuilder listBuilder = new OrderedListBuilder();
                     private final ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
                     private final AOrderedListType pointListType = new AOrderedListType(BuiltinType.APOINT, null);
 
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
index 22cae0f..ab73df2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/common/SimilarityJaccardCheckEvaluator.java
@@ -2,7 +2,6 @@
 
 import java.io.IOException;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.dataflow.data.nontagged.serde.AFloatSerializerDeserializer;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
@@ -24,7 +23,7 @@
     protected final ICopyEvaluator jaccThreshEval;
     protected float jaccThresh = -1f;
 
-    protected IAOrderedListBuilder listBuilder;
+    protected OrderedListBuilder listBuilder;
     protected ArrayBackedValueStorage inputVal;
     @SuppressWarnings("unchecked")
     protected final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
index 02e91b9..ca61b5b 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
@@ -2,9 +2,7 @@
 
 import java.io.IOException;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
-import edu.uci.ics.asterix.common.functions.FunctionConstants;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.ABoolean;
 import edu.uci.ics.asterix.om.functions.AsterixBuiltinFunctions;
@@ -55,7 +53,7 @@
 
         private final ICopyEvaluator edThreshEval;
         private int edThresh = -1;
-        private IAOrderedListBuilder listBuilder;
+        private final OrderedListBuilder listBuilder;
         private ArrayBackedValueStorage inputVal;
         @SuppressWarnings("unchecked")
         private final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
index 7675dd3..b909bc0 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/SimilarityJaccardPrefixCheckDescriptor.java
@@ -2,7 +2,6 @@
 
 import java.io.IOException;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.ABoolean;
@@ -52,7 +51,7 @@
 
     private static class SimilarityJaccardPrefixCheckEvaluator extends SimilarityJaccardPrefixEvaluator {
 
-        private final IAOrderedListBuilder listBuilder;
+        private final OrderedListBuilder listBuilder;
         private ArrayBackedValueStorage inputVal;
         @SuppressWarnings("unchecked")
         private final ISerializerDeserializer<ABoolean> booleanSerde = AqlSerializerDeserializerProvider.INSTANCE
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
index f8288ea..fdd45e2 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/evaluators/functions/StringToCodePointDescriptor.java
@@ -3,7 +3,6 @@
 import java.io.DataOutput;
 import java.io.IOException;
 
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.formats.nontagged.AqlSerializerDeserializerProvider;
 import edu.uci.ics.asterix.om.base.AInt32;
@@ -59,7 +58,7 @@
                     protected final ICopyEvaluator stringEval = args[0].createEvaluator(argOut);
                     protected final AOrderedListType intListType = new AOrderedListType(BuiltinType.AINT32, null);
 
-                    private IAOrderedListBuilder listBuilder = new OrderedListBuilder();
+                    private OrderedListBuilder listBuilder = new OrderedListBuilder();
                     private ArrayBackedValueStorage inputVal = new ArrayBackedValueStorage();
 
                     @SuppressWarnings("unchecked")
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmSchemafullRecordParserFactory.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmSchemafullRecordParserFactory.java
index c8511d2..3b0d1ab 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmSchemafullRecordParserFactory.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmSchemafullRecordParserFactory.java
@@ -13,9 +13,8 @@
 import edu.uci.ics.asterix.adm.parser.nontagged.AdmLexerConstants;
 import edu.uci.ics.asterix.adm.parser.nontagged.ParseException;
 import edu.uci.ics.asterix.adm.parser.nontagged.Token;
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.IARecordBuilder;
-import edu.uci.ics.asterix.builders.IAUnorderedListBuilder;
+import edu.uci.ics.asterix.builders.IAsterixListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.builders.RecordBuilder;
 import edu.uci.ics.asterix.builders.UnorderedListBuilder;
@@ -89,8 +88,8 @@
 
             private Queue<ArrayBackedValueStorage> baaosPool = new ArrayDeque<ArrayBackedValueStorage>();
             private Queue<IARecordBuilder> recordBuilderPool = new ArrayDeque<IARecordBuilder>();
-            private Queue<IAOrderedListBuilder> orderedListBuilderPool = new ArrayDeque<IAOrderedListBuilder>();
-            private Queue<IAUnorderedListBuilder> unorderedListBuilderPool = new ArrayDeque<IAUnorderedListBuilder>();
+            private Queue<IAsterixListBuilder> orderedListBuilderPool = new ArrayDeque<IAsterixListBuilder>();
+            private Queue<IAsterixListBuilder> unorderedListBuilderPool = new ArrayDeque<IAsterixListBuilder>();
 
             private String mismatchErrorMessage = "Mismatch Type, expecting a value of type ";
 
@@ -966,7 +965,7 @@
                 this.recordBuilderPool.add(recBuilder);
             }
 
-            private IAOrderedListBuilder getOrderedListBuilder() {
+            private IAsterixListBuilder getOrderedListBuilder() {
                 OrderedListBuilder orderedListBuilder = (OrderedListBuilder) orderedListBuilderPool.poll();
                 if (orderedListBuilder != null)
                     return orderedListBuilder;
@@ -974,11 +973,11 @@
                     return new OrderedListBuilder();
             }
 
-            private void returnOrderedListBuilder(IAOrderedListBuilder orderedListBuilder) {
+            private void returnOrderedListBuilder(IAsterixListBuilder orderedListBuilder) {
                 this.orderedListBuilderPool.add(orderedListBuilder);
             }
 
-            private IAUnorderedListBuilder getUnorderedListBuilder() {
+            private IAsterixListBuilder getUnorderedListBuilder() {
                 UnorderedListBuilder unorderedListBuilder = (UnorderedListBuilder) unorderedListBuilderPool.poll();
                 if (unorderedListBuilder != null)
                     return unorderedListBuilder;
@@ -986,7 +985,7 @@
                     return new UnorderedListBuilder();
             }
 
-            private void returnUnorderedListBuilder(IAUnorderedListBuilder unorderedListBuilder) {
+            private void returnUnorderedListBuilder(IAsterixListBuilder unorderedListBuilder) {
                 this.unorderedListBuilderPool.add(unorderedListBuilder);
             }
 
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmTupleParser.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmTupleParser.java
index 96540c3..65223c1 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmTupleParser.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/operators/file/AdmTupleParser.java
@@ -13,9 +13,8 @@
 import edu.uci.ics.asterix.adm.parser.nontagged.AdmLexerConstants;
 import edu.uci.ics.asterix.adm.parser.nontagged.ParseException;
 import edu.uci.ics.asterix.adm.parser.nontagged.Token;
-import edu.uci.ics.asterix.builders.IAOrderedListBuilder;
 import edu.uci.ics.asterix.builders.IARecordBuilder;
-import edu.uci.ics.asterix.builders.IAUnorderedListBuilder;
+import edu.uci.ics.asterix.builders.IAsterixListBuilder;
 import edu.uci.ics.asterix.builders.OrderedListBuilder;
 import edu.uci.ics.asterix.builders.RecordBuilder;
 import edu.uci.ics.asterix.builders.UnorderedListBuilder;
@@ -60,8 +59,8 @@
 
 	private Queue<ArrayBackedValueStorage> baaosPool = new ArrayDeque<ArrayBackedValueStorage>();
 	private Queue<IARecordBuilder> recordBuilderPool = new ArrayDeque<IARecordBuilder>();
-	private Queue<IAOrderedListBuilder> orderedListBuilderPool = new ArrayDeque<IAOrderedListBuilder>();
-	private Queue<IAUnorderedListBuilder> unorderedListBuilderPool = new ArrayDeque<IAUnorderedListBuilder>();
+	private Queue<IAsterixListBuilder> orderedListBuilderPool = new ArrayDeque<IAsterixListBuilder>();
+	private Queue<IAsterixListBuilder> unorderedListBuilderPool = new ArrayDeque<IAsterixListBuilder>();
 
 	private String mismatchErrorMessage = "Mismatch Type, expecting a value of type ";
 
@@ -659,7 +658,7 @@
 		this.recordBuilderPool.add(recBuilder);
 	}
 
-	private IAOrderedListBuilder getOrderedListBuilder() {
+	private IAsterixListBuilder getOrderedListBuilder() {
 		OrderedListBuilder orderedListBuilder = (OrderedListBuilder) orderedListBuilderPool
 				.poll();
 		if (orderedListBuilder != null)
@@ -669,11 +668,11 @@
 	}
 
 	private void returnOrderedListBuilder(
-			IAOrderedListBuilder orderedListBuilder) {
+	        IAsterixListBuilder orderedListBuilder) {
 		this.orderedListBuilderPool.add(orderedListBuilder);
 	}
 
-	private IAUnorderedListBuilder getUnorderedListBuilder() {
+	private IAsterixListBuilder getUnorderedListBuilder() {
 		UnorderedListBuilder unorderedListBuilder = (UnorderedListBuilder) unorderedListBuilderPool
 				.poll();
 		if (unorderedListBuilder != null)
@@ -683,7 +682,7 @@
 	}
 
 	private void returnUnorderedListBuilder(
-			IAUnorderedListBuilder unorderedListBuilder) {
+	        IAsterixListBuilder unorderedListBuilder) {
 		this.unorderedListBuilderPool.add(unorderedListBuilder);
 	}