Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. this.array = (X[]) Array.newInstance(init.getClass(), size);
  2.  
  3. // ...
  4.  
  5. public List<X> get() {
  6. return Collections.<X>unmodifiableList(this.array);
  7. }
  8.  
  9. public List<X> get() {
  10. return Collections.unmodifiableList(new ArrayList<>(this.array));
  11. }
  12.  
  13. public List<X> get() {
  14. return Arrays.asList(this.array);
  15. }
  16.  
  17. public List<X> get()
  18. {
  19. List<X> modifiableList = Arrays.asList( this.array );
  20. return Collections.unmodifiableList( modifiableList );
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement