package com.bbn.bue.common.collections;

import java.util.AbstractList;
import java.util.List;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Utilities for working with {@link java.util.List}s.
 */
public final class ListUtils {
  private ListUtils() {
    throw new UnsupportedOperationException();
  }

  /**
   * Returns an unmodifiable view of the concatenation of two lists.
   * This view will act like a {@link List} which has all of the items of
   * {@code first} followed by all of the items in {@code second}.
   */
  public static <E> List<E> concat(List<E> first, List<E> second) {
    return new ConcatenatedListView<E>(first, second);
  }

  /**
   * See {@link #concat(List, List)}.
   */
  private static final class ConcatenatedListView<E> extends AbstractList<E> {
    private final List<E> list1;
    private final List<E> list2;

    ConcatenatedListView(final List<E> list1, final List<E> list2) {
      // no defensive copies because this is a view
      this.list1 = checkNotNull(list1);
      this.list2 = checkNotNull(list2);
    }

    @Override
    public E get(final int index) {
      final boolean useFirstList = index < list1.size();
      final List<E> list = useFirstList ? list1 : list2;
      final int modifiedIdx = useFirstList ? index : index - list1.size();
      return list.get(modifiedIdx);
    }

    @Override
    public int size() {
      return list1.size() + list2.size();
    }
  }
}

@@ -587,16 +587,26 @@
 at(List%3C
+? extends 
 E%3E first
@@ -612,16 +612,26 @@
 t, List%3C
+? extends 
 E%3E secon
@@ -824,16 +824,17 @@
 st%3CE%3E %7B%0A
+%0A
     priv
@@ -840,32 +840,42 @@
 vate final List%3C
+? extends 
 E%3E list1;%0A    pr
@@ -883,32 +883,42 @@
 vate final List%3C
+? extends 
 E%3E list2;%0A%0A    C
@@ -944,24 +944,34 @@
 (final List%3C
+? extends 
 E%3E list1, fi
@@ -975,24 +975,34 @@
  final List%3C
+? extends 
 E%3E list2) %7B%0A
@@ -1264,16 +1264,26 @@
 al List%3C
+? extends 
 E%3E list 

Fix generics for ListUtils.concat