1 16 package org.apache.commons.collections.set; 17 18 import java.util.Comparator ; 19 import java.util.SortedSet ; 20 21 import org.apache.commons.collections.Transformer; 22 23 38 public class TransformedSortedSet extends TransformedSet implements SortedSet { 39 40 41 private static final long serialVersionUID = -1675486811351124386L; 42 43 53 public static SortedSet decorate(SortedSet set, Transformer transformer) { 54 return new TransformedSortedSet(set, transformer); 55 } 56 57 68 protected TransformedSortedSet(SortedSet set, Transformer transformer) { 69 super(set, transformer); 70 } 71 72 77 protected SortedSet getSortedSet() { 78 return (SortedSet ) collection; 79 } 80 81 public Object first() { 83 return getSortedSet().first(); 84 } 85 86 public Object last() { 87 return getSortedSet().last(); 88 } 89 90 public Comparator comparator() { 91 return getSortedSet().comparator(); 92 } 93 94 public SortedSet subSet(Object fromElement, Object toElement) { 96 SortedSet set = getSortedSet().subSet(fromElement, toElement); 97 return new TransformedSortedSet(set, transformer); 98 } 99 100 public SortedSet headSet(Object toElement) { 101 SortedSet set = getSortedSet().headSet(toElement); 102 return new TransformedSortedSet(set, transformer); 103 } 104 105 public SortedSet tailSet(Object fromElement) { 106 SortedSet set = getSortedSet().tailSet(fromElement); 107 return new TransformedSortedSet(set, transformer); 108 } 109 110 } 111 | Popular Tags |