< prev index next >
src/java.base/share/classes/java/time/ZoneId.java
Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD
*** 370,380 ****
* "GMT", "UTC", or "UT", or ""
*/
public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
Objects.requireNonNull(prefix, "prefix");
Objects.requireNonNull(offset, "offset");
! if (prefix.length() == 0) {
return offset;
}
if (!prefix.equals("GMT") && !prefix.equals("UTC") && !prefix.equals("UT")) {
throw new IllegalArgumentException("prefix should be GMT, UTC or UT, is: " + prefix);
--- 370,380 ----
* "GMT", "UTC", or "UT", or ""
*/
public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
Objects.requireNonNull(prefix, "prefix");
Objects.requireNonNull(offset, "offset");
! if (prefix.isEmpty()) {
return offset;
}
if (!prefix.equals("GMT") && !prefix.equals("UTC") && !prefix.equals("UT")) {
throw new IllegalArgumentException("prefix should be GMT, UTC or UT, is: " + prefix);
< prev index next >