8215401: Add isEmpty default method to CharSequence

Reviewed-by: jlaskey, rriggs, jjg, alanb, smarks, darcy
This commit is contained in:
Claes Redestad 2020-05-22 11:20:57 +02:00
parent 7d330d34f1
commit 113c48f5da
4 changed files with 133 additions and 1 deletions

View file

@ -1645,6 +1645,18 @@ public abstract class $Type$Buffer
return remaining();
}
/**
* Returns {@code true} if this character buffer is empty.
*
* @return {@code true} if there are {@code 0} remaining characters,
* otherwise {@code false}
*
* @since 15
*/
public final boolean isEmpty() {
return remaining() == 0;
}
/**
* Reads the character at the given index relative to the current
* position.