mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 05:08:03 +01:00
Remove several unused classes
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2020 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.util;
|
||||
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class ExecutorUtils {
|
||||
|
||||
public static Executor newFixedThreadBoundedQueueExecutor(int threadCount, int queueSize) {
|
||||
ThreadPoolExecutor executor = new ThreadPoolExecutor(threadCount, threadCount,
|
||||
Long.MAX_VALUE, TimeUnit.NANOSECONDS,
|
||||
new ArrayBlockingQueue<>(queueSize),
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
executor.prestartAllCoreThreads();
|
||||
|
||||
return executor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2020 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
package org.whispersystems.textsecuregcm.util;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class IterablePair <T1, T2> implements Iterable<Pair<T1,T2>> {
|
||||
private final List<T1> first;
|
||||
private final List<T2> second;
|
||||
|
||||
public IterablePair(List<T1> first, List<T2> second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Pair<T1, T2>> iterator(){
|
||||
return new ParallelIterator<>( first.iterator(), second.iterator() );
|
||||
}
|
||||
|
||||
public static class ParallelIterator <T1, T2> implements Iterator<Pair<T1, T2>> {
|
||||
|
||||
private final Iterator<T1> it1;
|
||||
private final Iterator<T2> it2;
|
||||
|
||||
public ParallelIterator(Iterator<T1> it1, Iterator<T2> it2) {
|
||||
this.it1 = it1; this.it2 = it2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() { return it1.hasNext() && it2.hasNext(); }
|
||||
|
||||
@Override
|
||||
public Pair<T1, T2> next() {
|
||||
return new Pair<>(it1.next(), it2.next());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(){
|
||||
it1.remove();
|
||||
it2.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package org.whispersystems.textsecuregcm.util;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class Optionals {
|
||||
|
||||
private Optionals() {}
|
||||
|
||||
/**
|
||||
* Apply a function to two optional arguments, returning empty if either argument is empty
|
||||
*
|
||||
* @param optionalT Optional of type T
|
||||
* @param optionalU Optional of type U
|
||||
* @param fun Function of T and U that returns R
|
||||
* @return The function applied to the values of optionalT and optionalU, or empty
|
||||
*/
|
||||
public static <T, U, R> Optional<R> zipWith(Optional<T> optionalT, Optional<U> optionalU, BiFunction<T, U, R> fun) {
|
||||
return optionalT.flatMap(t -> optionalU.map(u -> fun.apply(t, u)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user