|
|||||||||||||||||||
| This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Limit.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
package net.sf.flock.filter; |
|
| 2 |
|
|
| 3 |
import java.util.List; |
|
| 4 |
|
|
| 5 |
import net.sf.flock.FilterI; |
|
| 6 |
|
|
| 7 |
public class Limit implements FilterI {
|
|
| 8 |
|
|
| 9 |
private final int limit; |
|
| 10 |
|
|
| 11 | 0 |
public Limit(int limit) {
|
| 12 | 0 |
this.limit = limit; |
| 13 |
} |
|
| 14 |
|
|
| 15 | 0 |
public List filter(List items) {
|
| 16 | 0 |
return items.subList(0, Math.min(items.size(), this.limit)); |
| 17 |
} |
|
| 18 |
|
|
| 19 |
} |
|
| 20 |
|
|
||||||||||