Created
August 11, 2015 21:02
-
-
Save skyebook/a20bdf1b1b013e659407 to your computer and use it in GitHub Desktop.
Clamped subList
This file contains hidden or 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
package donald.trump.for.president; | |
import java.util.List; | |
public class ListUtils { | |
/** | |
* Return a list containing, at most, the number of requested objects. If | |
* there are less than <code>count</code> items present, all items in the | |
* list are returned. | |
*/ | |
public static List clampedSubList(List list, int count) { | |
return list.subList(0, Math.min(count, list.size())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment