Last active
April 12, 2016 21:22
-
-
Save keweishang/d03b9c816f4547e5a0ab3b7b3e6c0dba to your computer and use it in GitHub Desktop.
Original version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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