1 17 package org.apache.commons.collections.primitives; 18 19 import org.apache.commons.collections.primitives.decorators.UnmodifiableFloatIterator; 20 import org.apache.commons.collections.primitives.decorators.UnmodifiableFloatList; 21 import org.apache.commons.collections.primitives.decorators.UnmodifiableFloatListIterator; 22 23 34 public final class FloatCollections { 35 36 41 public static FloatList singletonFloatList(float value) { 42 FloatList list = new ArrayFloatList(1); 44 list.add(value); 45 return UnmodifiableFloatList.wrap(list); 46 } 47 48 53 public static FloatIterator singletonFloatIterator(float value) { 54 return singletonFloatList(value).iterator(); 55 } 56 57 62 public static FloatListIterator singletonFloatListIterator(float value) { 63 return singletonFloatList(value).listIterator(); 64 } 65 66 73 public static FloatList unmodifiableFloatList(FloatList list) throws NullPointerException { 74 if(null == list) { 75 throw new NullPointerException (); 76 } 77 return UnmodifiableFloatList.wrap(list); 78 } 79 80 87 public static FloatIterator unmodifiableFloatIterator(FloatIterator iter) { 88 if(null == iter) { 89 throw new NullPointerException (); 90 } 91 return UnmodifiableFloatIterator.wrap(iter); 92 } 93 94 101 public static FloatListIterator unmodifiableFloatListIterator(FloatListIterator iter) { 102 if(null == iter) { 103 throw new NullPointerException (); 104 } 105 return UnmodifiableFloatListIterator.wrap(iter); 106 } 107 108 113 public static FloatList getEmptyFloatList() { 114 return EMPTY_FLOAT_LIST; 115 } 116 117 122 public static FloatIterator getEmptyFloatIterator() { 123 return EMPTY_FLOAT_ITERATOR; 124 } 125 126 131 public static FloatListIterator getEmptyFloatListIterator() { 132 return EMPTY_FLOAT_LIST_ITERATOR; 133 } 134 135 139 public static final FloatList EMPTY_FLOAT_LIST = unmodifiableFloatList(new ArrayFloatList(0)); 140 141 145 public static final FloatIterator EMPTY_FLOAT_ITERATOR = unmodifiableFloatIterator(EMPTY_FLOAT_LIST.iterator()); 146 147 151 public static final FloatListIterator EMPTY_FLOAT_LIST_ITERATOR = unmodifiableFloatListIterator(EMPTY_FLOAT_LIST.listIterator()); 152 } 153 | Popular Tags |