Skip to content

Instantly share code, notes, and snippets.

@jpetitto
Created October 29, 2015 15:33
Show Gist options
  • Save jpetitto/0ac474ca01fc1a0c840e to your computer and use it in GitHub Desktop.
Save jpetitto/0ac474ca01fc1a0c840e to your computer and use it in GitHub Desktop.
Less Hacky Loop
private <T> int picker(List<T> src, List<T> dst, int limit) {
Iterator<T> iterator = src.iterator();
while (iterator.hasNext() && limit > 0) {
dst.add(iterator.next());
limit--;
}
return limit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment