Add and fix Checkstyle NoWhitespaceBeforeCaseDefaultColon

This commit is contained in:
Gary Gregory 2024-10-03 17:29:55 -04:00
parent 706178d022
commit 6b7e51a6e4
4 changed files with 16 additions and 14 deletions

View File

@ -61,6 +61,7 @@ limitations under the License.
<module name="WhitespaceAfter"/> <module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/> <module name="WhitespaceAround"/>
<module name="NoWhitespaceBefore"/> <module name="NoWhitespaceBefore"/>
<module name="NoWhitespaceBeforeCaseDefaultColon"/>
<module name="ImportOrder"> <module name="ImportOrder">
<property name="option" value="top"/> <property name="option" value="top"/>
<property name="groups" value="java,javax,junit,org,com"/> <property name="groups" value="java,javax,junit,org,com"/>

View File

@ -277,21 +277,21 @@ public class TreeList<E> extends AbstractList<E> {
*/ */
private AVLNode<E> balance() { private AVLNode<E> balance() {
switch (heightRightMinusLeft()) { switch (heightRightMinusLeft()) {
case 1 : case 1:
case 0 : case 0:
case -1 : case -1:
return this; return this;
case -2 : case -2:
if (left.heightRightMinusLeft() > 0) { if (left.heightRightMinusLeft() > 0) {
setLeft(left.rotateLeft(), null); setLeft(left.rotateLeft(), null);
} }
return rotateRight(); return rotateRight();
case 2 : case 2:
if (right.heightRightMinusLeft() < 0) { if (right.heightRightMinusLeft() < 0) {
setRight(right.rotateRight(), null); setRight(right.rotateRight(), null);
} }
return rotateLeft(); return rotateLeft();
default : default:
throw new IllegalStateException("tree inconsistent!"); throw new IllegalStateException("tree inconsistent!");
} }
} }

View File

@ -131,16 +131,17 @@ public abstract class AbstractNavigableSetTest<E> extends AbstractSortedSetTest<
public E[] getOtherElements() { public E[] getOtherElements() {
return otherElements; return otherElements;
} }
private NavigableSet<E> getSubSet(final NavigableSet<E> set) { private NavigableSet<E> getSubSet(final NavigableSet<E> set) {
final E[] elements = AbstractNavigableSetTest.this.getFullElements(); final E[] elements = AbstractNavigableSetTest.this.getFullElements();
switch (type) { switch (type) {
case TYPE_SUBSET : case TYPE_SUBSET:
return set.subSet(elements[lowBound], inclusive, elements[highBound], inclusive); return set.subSet(elements[lowBound], inclusive, elements[highBound], inclusive);
case TYPE_HEADSET : case TYPE_HEADSET:
return set.headSet(elements[highBound], inclusive); return set.headSet(elements[highBound], inclusive);
case TYPE_TAILSET : case TYPE_TAILSET:
return set.tailSet(elements[lowBound], inclusive); return set.tailSet(elements[lowBound], inclusive);
default : default:
return null; return null;
} }
} }

View File

@ -127,13 +127,13 @@ public abstract class AbstractSortedSetTest<E> extends AbstractSetTest<E> {
private SortedSet<E> getSubSet(final SortedSet<E> set) { private SortedSet<E> getSubSet(final SortedSet<E> set) {
final E[] elements = AbstractSortedSetTest.this.getFullElements(); final E[] elements = AbstractSortedSetTest.this.getFullElements();
switch (type) { switch (type) {
case TYPE_SUBSET : case TYPE_SUBSET:
return set.subSet(elements[lowBound], elements[highBound]); return set.subSet(elements[lowBound], elements[highBound]);
case TYPE_HEADSET : case TYPE_HEADSET:
return set.headSet(elements[highBound]); return set.headSet(elements[highBound]);
case TYPE_TAILSET : case TYPE_TAILSET:
return set.tailSet(elements[lowBound]); return set.tailSet(elements[lowBound]);
default : default:
return null; return null;
} }
} }