@@ -219,7 +219,7 @@ private Keyboard loadSavedKeyboard()
219219 @ SuppressWarnings ("BooleanMethodIsAlwaysInverted" )
220220 private static boolean isCommentLine (final String line )
221221 {
222- return line .startsWith ("#" ) || line .length () == 0 ;
222+ return line .startsWith ("#" ) || line .isEmpty () ;
223223 }
224224
225225 @ SuppressWarnings ("SameParameterValue" )
@@ -565,7 +565,7 @@ private void effectStrokeAppend(final String strokeDigit)
565565 {
566566 final String newStrokeDigitSequence = strokeDigitSequence + strokeDigit ;
567567 final List <String > newCandidates = computeCandidates (newStrokeDigitSequence );
568- if (newCandidates .size () > 0 )
568+ if (! newCandidates .isEmpty () )
569569 {
570570 setStrokeDigitSequence (newStrokeDigitSequence );
571571 setCandidates (newCandidates );
@@ -574,15 +574,15 @@ private void effectStrokeAppend(final String strokeDigit)
574574
575575 private void effectBackspace (final InputConnection inputConnection )
576576 {
577- if (strokeDigitSequence .length () > 0 )
577+ if (! strokeDigitSequence .isEmpty () )
578578 {
579579 final String newStrokeDigitSequence = Stringy .removeSuffixRegex ("(?s)." , strokeDigitSequence );
580580 final List <String > newCandidates = computeCandidates (newStrokeDigitSequence );
581581
582582 setStrokeDigitSequence (newStrokeDigitSequence );
583583 setCandidates (newCandidates );
584584
585- if (newStrokeDigitSequence .length () == 0 )
585+ if (newStrokeDigitSequence .isEmpty () )
586586 {
587587 setPhraseCompletionCandidates (inputConnection );
588588 }
@@ -593,7 +593,7 @@ private void effectBackspace(final InputConnection inputConnection)
593593 {
594594 final String upToOneCharacterBeforeCursor = getTextBeforeCursor (inputConnection , 1 );
595595
596- if (upToOneCharacterBeforeCursor .length () > 0 )
596+ if (! upToOneCharacterBeforeCursor .isEmpty () )
597597 {
598598 final CharSequence selection = inputConnection .getSelectedText (0 );
599599 if (TextUtils .isEmpty (selection ))
@@ -629,7 +629,7 @@ private void effectKeyboardSwitch(final String keyboardName)
629629
630630 private void effectSpaceKey (final InputConnection inputConnection )
631631 {
632- if (strokeDigitSequence .length () > 0 )
632+ if (! strokeDigitSequence .isEmpty () )
633633 {
634634 onCandidate (getFirstCandidate ());
635635 }
@@ -641,7 +641,7 @@ private void effectSpaceKey(final InputConnection inputConnection)
641641
642642 private void effectEnterKey (final InputConnection inputConnection )
643643 {
644- if (strokeDigitSequence .length () > 0 )
644+ if (! strokeDigitSequence .isEmpty () )
645645 {
646646 onCandidate (getFirstCandidate ());
647647 }
@@ -657,7 +657,7 @@ else if (enterKeyHasAction)
657657
658658 private void effectOrdinaryKey (final InputConnection inputConnection , final String valueText )
659659 {
660- if (strokeDigitSequence .length () > 0 )
660+ if (! strokeDigitSequence .isEmpty () )
661661 {
662662 return ;
663663 }
@@ -820,7 +820,7 @@ private int computeCandidateRank(
820820 final int fineRank ;
821821 final int penalty ;
822822
823- final boolean phraseCompletionsIsEmpty = phraseCompletionFirstCodePoints .size () == 0 ;
823+ final boolean phraseCompletionsIsEmpty = phraseCompletionFirstCodePoints .isEmpty () ;
824824 final int phraseCompletionIndex = phraseCompletionFirstCodePoints .indexOf (firstCodePoint );
825825 final boolean firstCodePointMatchesPhraseCompletionCandidate = phraseCompletionIndex > 0 ;
826826
@@ -864,7 +864,7 @@ else if (firstCodePointMatchesPhraseCompletionCandidate)
864864
865865 private List <String > computeCandidates (final String strokeDigitSequence )
866866 {
867- if (strokeDigitSequence .length () == 0 )
867+ if (strokeDigitSequence .isEmpty () )
868868 {
869869 return Collections .emptyList ();
870870 }
@@ -947,7 +947,7 @@ private List<String> computePhraseCompletionCandidates(final InputConnection inp
947947
948948 for (
949949 String phrasePrefix = getTextBeforeCursor (inputConnection , MAX_PHRASE_LENGTH - 1 );
950- phrasePrefix .length () > 0 ;
950+ ! phrasePrefix .isEmpty () ;
951951 phrasePrefix = Stringy .removePrefixRegex ("(?s)." , phrasePrefix )
952952 )
953953 {
0 commit comments