LoginSignup
12
11

More than 5 years have passed since last update.

java8のAPIを読んで、目立たない変更を発見するメモ

Last updated at Posted at 2014-07-27

Effective Javaで「APIの基本的なところくらい読んどけ」と書いてあった気がするので
読むついでにJava8で「なんか増えてる!」と発見したことをメモします。
随時追記していきます。

java.langパッケージ

Booleanクラス

public static boolean logicalAnd(boolean a, boolean b)
public static boolean logicalOr(boolean a, boolean b)
public static boolean logicalXor(boolean a, boolean b)
* 上から論理積、論理和、排他的論理和を返す。使いどころがわかりません。

Byteクラス

public static int hashCode(byte value)

  • 他のラッパークラスにもありましたが、使いどころがわかりません。内部実装で使われてるのかな?

public static int toUnsignedInt(byte x)
public static int toUnsignedLong(byte x)

  • unsignedへの変換キタ!今までは&演算でマスクしたりしないといけませんでした。

Doubleクラス

public static double sum(double a, double b)
public static double max(double a, double b)
public static double min(double a, double b)

  • Integerとか他のラッパクラスにもありました。

Integerクラス

public static String toUnsignedString(int i)
public static String toUnsignedString(int i, int radix)
public static int parseUnsignedInt(String s)
public static int compareUnsigned(int x, int y)
public static int divideUnsigned(int dividend, int divisor)
public static int remainderUnsigned(int dividend, int divisor)

  • Byteクラス然り、unsignedのサポートが地味に増えてます。

Stringクラス

public static String join(CharSequence delimiter, CharSequence... elements)
public static String join(CharSequence delimiter, Iterable<? extends CharSequence> elements)

  • お待ちかねの文字列結合。やっと、という感じ。
12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11