Remove several unused classes

This commit is contained in:
Chris Eager
2023-11-01 12:51:56 -05:00
committed by Chris Eager
parent c4079a3b11
commit 570aa4b9e2
12 changed files with 2 additions and 344 deletions

View File

@@ -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;
}
}

View File

@@ -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();
}
}
}

View File

@@ -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)));
}
}