MCPcopy Index your code
hub / github.com/OpenFeign/feign / removeValues

Method removeValues

core/src/main/java/feign/Util.java:146–156  ·  view source on GitHub ↗

Removes values from the array that meet the criteria for removal via the supplied Predicate value

(T[] values, Predicate<T> shouldRemove, Class<T> type)

Source from the content-addressed store, hash-verified

144 * Predicate} value
145 */
146 @SuppressWarnings("unchecked")
147 public static <T> T[] removeValues(T[] values, Predicate<T> shouldRemove, Class<T> type) {
148 Collection<T> collection = new ArrayList<>(values.length);
149 for (T value : values) {
150 if (shouldRemove.negate().test(value)) {
151 collection.add(value);
152 }
153 }
154 T[] array = (T[]) Array.newInstance(type, collection.size());
155 return collection.toArray(array);
156 }
157
158 /** Adapted from {@code com.google.common.base.Strings#emptyToNull}. */
159 @SuppressWarnings("unchecked")

Callers 4

removesEmptyStringsMethod · 0.80
removesEvenNumbersMethod · 0.80

Calls 5

toArrayMethod · 0.80
testMethod · 0.65
addMethod · 0.45
newInstanceMethod · 0.45
sizeMethod · 0.45

Tested by 2

removesEmptyStringsMethod · 0.64
removesEvenNumbersMethod · 0.64