/** {@inheritDoc} */ @SuppressWarnings({"SuspiciousMethodCalls"}) public boolean retainAll(Collection<?> collection) { boolean modified = false; TShortIterator iter = iterator(); while (iter.hasNext()) { if (!collection.contains(Short.valueOf(iter.next()))) { iter.remove(); modified = true; } } return modified; }
@SuppressWarnings("UnnecessaryBoxing") private static Object box(final Object value) { Object newBoxedValue; if (value instanceof Integer) { newBoxedValue = Integer.valueOf(((Integer) value).intValue()); } else if (value instanceof Byte) { newBoxedValue = Byte.valueOf(((Byte) value).byteValue()); } else if (value instanceof Short) { newBoxedValue = Short.valueOf(((Short) value).shortValue()); } else if (value instanceof Long) { newBoxedValue = Long.valueOf(((Long) value).longValue()); } else if (value instanceof Boolean) { newBoxedValue = Boolean.valueOf(((Boolean) value).booleanValue()); } else if (value instanceof Character) { newBoxedValue = Character.valueOf(((Character) value).charValue()); } else { return new Object(); } return newBoxedValue; }