List of utility methods to do ReentrantLock
Collection | toLazyCollection(Stream stream) Projects an immutable collection of this stream. return toLazyCollection(stream.iterator());
|
byte[] | xor(byte[] a, byte[] b) xor lock.lock(); try { if (a.length != b.length) throw new RuntimeException("inputs must be equal lengths"); byte[] result = new byte[a.length]; for (int i = 0; i < a.length; i++) { result[i] = (byte) (0xff & ((int) a[i]) ^ ((int) b[i])); return result; } finally { lock.unlock(); |