1 16 package org.apache.commons.collections.bag; 17 18 import java.util.Comparator ; 19 20 import org.apache.commons.collections.Predicate; 21 import org.apache.commons.collections.SortedBag; 22 23 42 public class PredicatedSortedBag 43 extends PredicatedBag implements SortedBag { 44 45 46 private static final long serialVersionUID = 3448581314086406616L; 47 48 60 public static SortedBag decorate(SortedBag bag, Predicate predicate) { 61 return new PredicatedSortedBag(bag, predicate); 62 } 63 64 76 protected PredicatedSortedBag(SortedBag bag, Predicate predicate) { 77 super(bag, predicate); 78 } 79 80 85 protected SortedBag getSortedBag() { 86 return (SortedBag) getCollection(); 87 } 88 89 public Object first() { 91 return getSortedBag().first(); 92 } 93 94 public Object last() { 95 return getSortedBag().last(); 96 } 97 98 public Comparator comparator() { 99 return getSortedBag().comparator(); 100 } 101 102 } 103 | Popular Tags |