Skip to content

Instantly share code, notes, and snippets.

@keweishang
Last active April 12, 2016 21:22
Show Gist options
  • Save keweishang/d03b9c816f4547e5a0ab3b7b3e6c0dba to your computer and use it in GitHub Desktop.
Save keweishang/d03b9c816f4547e5a0ab3b7b3e6c0dba to your computer and use it in GitHub Desktop.
Original version
public class ListFactory {
public static List<Integer> newInstance(final int[] numbers) {
return new AbstractList<Integer>() {
@Override
public Integer get(int index) {
return numbers[index];
}
@Override
public int size() {
return numbers.length;
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment