Class Jdk8

java.lang.Object
com.kamikazejam.kamicommon.util.Jdk8

@Internal public final class Jdk8 extends Object
Stand-ins for String methods added after Java 8.

KamiCommon's always-loaded modules target Java 8 so that 1.8.x servers can load them, which rules out String.repeat(int) and String.strip(), both Java 11. These are the same operations, spelled for Java 8.

Internal. Use the JDK methods directly in your own code; this exists only because this library cannot.

  • Method Details

    • repeat

      @NotNull public static @NotNull String repeat(@NotNull @NotNull String value, int count)
      Stand-in for String.repeat(int), which is Java 11.
      Parameters:
      value - the string to repeat
      count - how many times, must not be negative
      Returns:
      the repeated string
    • strip

      @NotNull public static @NotNull String strip(@NotNull @NotNull String value)
      Stand-in for String.strip(), which is Java 11.

      Deliberately not trim(): trim cuts everything at or below U+0020, which drops control characters it should not and keeps Unicode spaces it should. This uses Character.isWhitespace(int), as strip() does.

      Parameters:
      value - the string to strip
      Returns:
      the string without leading or trailing whitespace