Skip to content

Commit

Permalink
Make private static classes final
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Oct 10, 2023
1 parent f30607f commit bb99f20
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private int getFreq(final Object obj, final Map<?, Integer> freqMap) {
* Helper class for set-related operations, e.g. union, subtract, intersection.
* @param <O> the element type
*/
private static class SetOperationCardinalityHelper<O> extends CardinalityHelper<O> implements Iterable<O> {
private static final class SetOperationCardinalityHelper<O> extends CardinalityHelper<O> implements Iterable<O> {

/** Contains the unique elements of the two collections. */
private final Set<O> elements;
Expand Down Expand Up @@ -712,7 +712,7 @@ public static <E> int hashCode(final Collection<? extends E> collection,
* @param <O> the element type
* @since 4.0
*/
private static class EquatorWrapper<O> {
private static final class EquatorWrapper<O> {
private final Equator<? super O> equator;
private final O object;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void visitKeepCommand(final E object) {
* Provides a partition view on a {@link List}.
* @since 4.0
*/
private static class Partition<T> extends AbstractList<List<T>> {
private static final class Partition<T> extends AbstractList<List<T>> {
private final List<T> list;
private final int size;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class SplitMapUtils {
private SplitMapUtils() {}


private static class WrappedGet<K, V> implements IterableMap<K, V>, Unmodifiable {
private static final class WrappedGet<K, V> implements IterableMap<K, V>, Unmodifiable {
private final Get<K, V> get;

private WrappedGet(final Get<K, V> get) {
Expand Down Expand Up @@ -136,7 +136,7 @@ public MapIterator<K, V> mapIterator() {
}
}

private static class WrappedPut<K, V> implements Map<K, V>, Put<K, V> {
private static final class WrappedPut<K, V> implements Map<K, V>, Put<K, V> {
private final Put<K, V> put;

private WrappedPut(final Put<K, V> put) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ public V next() {
/**
* Inner class that provides a simple reflection factory.
*/
private static class ReflectionFactory<T extends Collection<?>> implements Factory<T>, Serializable {
private static final class ReflectionFactory<T extends Collection<?>> implements Factory<T>, Serializable {

/** Serialization version */
private static final long serialVersionUID = 2986114157496788874L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public Iterator<E> iterator() {
/**
* Inner class iterator for the MultiSet.
*/
private static class MapBasedMultiSetIterator<E> implements Iterator<E> {
private static final class MapBasedMultiSetIterator<E> implements Iterator<E> {
private final AbstractMapMultiSet<E> parent;
private final Iterator<Map.Entry<E, MutableInteger>> entryIterator;
private Map.Entry<E, MutableInteger> current;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public Iterator<E> iterator() {
/**
* Inner class iterator for the MultiSet.
*/
private static class MultiSetIterator<E> implements Iterator<E> {
private static final class MultiSetIterator<E> implements Iterator<E> {
private final AbstractMultiSet<E> parent;
private final Iterator<Entry<E>> entryIterator;
private Entry<E> current;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
public class PropertiesFactory extends AbstractPropertiesFactory<Properties> {

private static class EmptyProperties extends Properties {
private static final class EmptyProperties extends Properties {

private static final long serialVersionUID = 1L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private void buildScript(final int start1, final int end1, final int start2, fin
* This class is a simple placeholder to hold the end part of a path
* under construction in a {@link SequencesComparator SequencesComparator}.
*/
private static class Snake {
private static final class Snake {

/** Start index. */
private final int start;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ static boolean isValidUplink(final TrieEntry<?, ?> next, final TrieEntry<?, ?> f
* wise there's no difference (except for the need to load the
* {@link Reference} Class but that happens only once).
*/
private static class Reference<E> {
private static final class Reference<E> {

private E item;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private static void test(final Map<String, String> map, final String name) {
System.out.println(name + (endMillis - startMillis));
}

private static class DummyMap<K, V> implements Map<K, V> {
private static final class DummyMap<K, V> implements Map<K, V> {
@Override
public void clear() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testSerializeDeserializeCheckComparator() throws Exception {
}
}

private static class IntegerComparator implements Comparator<Integer>, Serializable{
private static final class IntegerComparator implements Comparator<Integer>, Serializable{
private static final long serialVersionUID = 1L;
@Override
public int compare(final Integer o1, final Integer o2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public final void testFromBitMapProducerTest() {
}
}

private static class TestingBitMapProducer implements BitMapProducer {
private static final class TestingBitMapProducer implements BitMapProducer {
long[] values;

TestingBitMapProducer(final long[] values) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void fromBitMapProducerTest() {
}
}

private static class TestingBitMapProducer implements BitMapProducer {
private static final class TestingBitMapProducer implements BitMapProducer {
long[] values;

TestingBitMapProducer(final long[] values) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private void checkPredicatedCollection2(final Collection<Integer> collection) {
assertEquals(3, collection.size());
}

private static class OddPredicate implements Predicate<Integer> {
private static final class OddPredicate implements Predicate<Integer> {
@Override
public boolean evaluate(final Integer value) {
return value % 2 == 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
*/
public class TransformedCollectionTest extends AbstractCollectionTest<Object> {

private static class StringToInteger implements Transformer<Object, Object> {
private static final class StringToInteger implements Transformer<Object, Object> {
@Override
public Object transform(final Object input) {
return Integer.valueOf((String) input);
}
}

private static class ToLowerCase implements Transformer<Object, Object> {
private static final class ToLowerCase implements Transformer<Object, Object> {
@Override
public Object transform(final Object input) {
return ((String) input).toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


public class ComparatorPredicateTest extends AbstractPredicateTest {
private static class TestComparator<T extends Comparable<T>> implements Comparator<T> {
private static final class TestComparator<T extends Comparable<T>> implements Comparator<T> {
@Override
public int compare(final T first, final T second) {
return first.compareTo(second);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@SuppressWarnings("boxing")
public class LazySortedMapTest<K, V> extends AbstractSortedMapTest<K, V> {

private static class ReverseStringComparator implements Comparator<String> {
private static final class ReverseStringComparator implements Comparator<String> {

@Override
public int compare(final String arg0, final String arg1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
public class PassiveExpiringMapTest<K, V> extends AbstractMapTest<K, V> {

private static class TestExpirationPolicy
private static final class TestExpirationPolicy
implements ExpirationPolicy<Integer, String> {

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ private static void gc() {
}
}

private static class AccessibleEntry<K, V> extends ReferenceEntry<K, V> {
private static final class AccessibleEntry<K, V> extends ReferenceEntry<K, V> {
final AbstractReferenceMap<K, V> parent;
final Consumer<V> consumer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private List<Character> sequence(final String string) {
return list;
}

private static class ExecutionVisitor<T> implements CommandVisitor<T> {
private static final class ExecutionVisitor<T> implements CommandVisitor<T> {

private List<T> v;
private int index;
Expand Down

0 comments on commit bb99f20

Please sign in to comment.