Utils { public static <K> Collection<K> difference(Collection<K> collection1, Collection<K> result, Collection<K> collection2) { for (Iterator<K> iterator = collection1.iterator(); iterator.hasNext();) { K item = iterator.next(); if (!collection2.contains(item)) { result.add(item); } } return result; }  static ByteBuffer loadFile(File file); static Number160 makeSHAHash(File file); static Number160 makeSHAHash(String strInput); static Number160 makeSHAHash(ByteBuffer buffer); static Number160 makeSHAHash(DataBuffer buffer); static Number160 makeSHAHash(byte[] buffer); static Number160 makeSHAHash(byte[] buffer, int offset, int length); static byte[] makeMD5Hash(byte[] buffer); static byte[] makeMD5Hash(byte[] buffer, int offset, int length); static Number160 createRandomNodeID(); static byte[] compress(byte[] input); static byte[] uncompress(byte[] compressedData, int offset, int length); static byte[] uncompress(byte[] compressedData); static byte[] encodeJavaObject(Object attachement); static Object decodeJavaObject(ByteBuf channelBuffer); static synchronized Object decodeJavaObject(DataBuffer dataBuffer); static InputStream createInputStream(final ByteBuffer buf); static Object decodeJavaObject(byte[] me, int offset, int length); static Collection<K> difference(Collection<K> collection1, Collection<K> result,
            Collection<K> collection2); static Collection<K> difference(Collection<K> collection1, Collection<K> result,
            Collection<K>... collections2); static void bestEffortclose(Closeable... closables); static final byte[] intToByteArray(int value); static final int byteArrayToInt(byte[] b); static K pollRandom(Collection<K> collection, Random rnd); static K peekRandom(Collection<K> collection, Random rnd); static Entry<K, V> pollRandomKey(Map<K, V> queueToAsk, Random rnd); static Collection<K> subtract(final Collection<K> a, final Collection<K> b); static Map<K, V> subtract(final Map<K, V> a, final Collection<K> b); static Map<K, V> disjunction(final Map<K, V> a, final Collection<K> b); static Collection<K> limit(final Collection<K> a, final int size); static Map<K, V> limit(final Map<K, V> a, final int i); static String debugArray(byte[] array, int offset, int length); static String debugArray(byte[] array); static TrackerData limitRandom(TrackerData activePeers, int trackerSize); static K getLast(List<K> list); static Inet4Address fromInteger(int address); static File createTempDir(); static void nullCheck(Object... objects); static boolean nullCheckRetVal(Object... objects); static Collection<Number160> extractContentKeys(Collection<Number480> collection); static InetAddress inet4FromBytes(final byte[] src, final int offset); static InetAddress inet6FromBytes(final byte[] me, final int offset); static BitSet createBitSet(final byte b); static byte createByte(final BitSet bitSet); static void addReleaseListener(final ChannelCreator channelCreator,
            final BaseFuture... baseFutures); static void addReleaseListener(final FutureChannelCreator fcc, final BaseFuture baseFuture); static boolean isSameSets(final Collection<T> set1, final Collection<T> set2); static boolean isSameCollectionSets(final Collection<? extends Collection<T>> set1,
			final Collection<? extends Collection<T>> set2); static boolean equals(Object a, Object b); static String hash(PublicKey publicKey); static Map<Number640, Byte> setMapError(Map<Number640, ?> dataMap, byte reason); static int randomPositiveInt(int upperBound); static InetSocketAddress natReflection(InetSocketAddress recipient, boolean udp, PeerAddress self); static PeerSocketAddress extractRandomRelay(final Message message); static final int IPV4_BYTES; static final int IPV6_BYTES; static final int BYTE_BITS; static final int MASK_0F; static final int MASK_80; static final int MASK_FF; static final int BYTE_BYTE_SIZE; static final int SHORT_BYTE_SIZE; static final int INTEGER_BYTE_SIZE; static final int LONG_BYTE_SIZE; static final byte[] EMPTY_BYTE_ARRAY; }
@Test public void testDifference2() { Collection<String> collection1 = new ArrayList<String>(); Collection<String> result = new ArrayList<String>(); Collection<String> collection2 = new ArrayList<String>(); Collection<String> collection3 = new ArrayList<String>(); collection1.add("hallo"); collection1.add("test"); collection1.add("world"); collection2.add("test"); collection3.add("hallo"); Utils.difference(collection1, result, collection2, collection3); Assert.assertEquals(1, result.size()); }
@Test public void testDifference3() { Collection<String> collection1 = new ArrayList<String>(); Collection<String> result = new ArrayList<String>(); Collection<String> collection2 = new ArrayList<String>(); Collection<String> collection3 = new ArrayList<String>(); collection1.add("hallo"); collection2.add("world"); collection2.add("test"); collection2.add("hallo"); collection1.add("test"); Utils.difference(collection1, result, collection2, collection3); Assert.assertEquals(0, result.size()); }
@Test public void testDifference4() { Collection<String> collection1 = new ArrayList<String>(); Collection<String> result = new ArrayList<String>(); Collection<String> collection2 = new ArrayList<String>(); Collection<String> collection3 = new ArrayList<String>(); Utils.difference(collection1, result, collection2, collection3); Assert.assertEquals(0, result.size()); }
@Test public void testDifference5() { Collection<String> collection1 = new ArrayList<String>(); Collection<String> result = new ArrayList<String>(); Collection<String> collection2 = new ArrayList<String>(); Collection<String> collection3 = new ArrayList<String>(); collection1.add("test"); Utils.difference(collection1, result, collection2, collection3); Assert.assertEquals(1, result.size()); }
@Test public void testDifference1() { Collection<String> collection1 = new ArrayList<String>(); Collection<String> result = new ArrayList<String>(); Collection<String> collection2 = new ArrayList<String>(); Collection<String> collection3 = new ArrayList<String>(); collection1.add("hallo"); collection1.add("test"); collection2.add("test"); collection2.add("hallo"); Utils.difference(collection1, result, collection2, collection3); Assert.assertEquals(0, result.size()); }