< prev index next >

src/java.base/share/classes/java/lang/Long.java

Print this page
rev 52981 : 8215300: additional changes to constants API


1950      */
1951     public static long max(long a, long b) {
1952         return Math.max(a, b);
1953     }
1954 
1955     /**
1956      * Returns the smaller of two {@code long} values
1957      * as if by calling {@link Math#min(long, long) Math.min}.
1958      *
1959      * @param a the first operand
1960      * @param b the second operand
1961      * @return the smaller of {@code a} and {@code b}
1962      * @see java.util.function.BinaryOperator
1963      * @since 1.8
1964      */
1965     public static long min(long a, long b) {
1966         return Math.min(a, b);
1967     }
1968 
1969     /**
1970      * Returns a nominal descriptor for this instance, which is the instance
1971      * itself.
1972      *
1973      * @return an {@link Optional} describing the {@linkplain Long} instance
1974      * @since 12
1975      */
1976     @Override
1977     public Optional<Long> describeConstable() {
1978         return Optional.of(this);
1979     }
1980 
1981     /**
1982      * Resolves this instance as a {@link ConstantDesc}, the result of which is
1983      * the instance itself.
1984      *
1985      * @param lookup ignored
1986      * @return the {@linkplain Long} instance
1987      * @since 12
1988      */
1989     @Override
1990     public Long resolveConstantDesc(MethodHandles.Lookup lookup) {
1991         return this;


1950      */
1951     public static long max(long a, long b) {
1952         return Math.max(a, b);
1953     }
1954 
1955     /**
1956      * Returns the smaller of two {@code long} values
1957      * as if by calling {@link Math#min(long, long) Math.min}.
1958      *
1959      * @param a the first operand
1960      * @param b the second operand
1961      * @return the smaller of {@code a} and {@code b}
1962      * @see java.util.function.BinaryOperator
1963      * @since 1.8
1964      */
1965     public static long min(long a, long b) {
1966         return Math.min(a, b);
1967     }
1968 
1969     /**
1970      * Returns an {@link Optional} containing the nominal descriptor for this
1971      * instance, which is the instance itself.
1972      *
1973      * @return an {@link Optional} describing the {@linkplain Long} instance
1974      * @since 12
1975      */
1976     @Override
1977     public Optional<Long> describeConstable() {
1978         return Optional.of(this);
1979     }
1980 
1981     /**
1982      * Resolves this instance as a {@link ConstantDesc}, the result of which is
1983      * the instance itself.
1984      *
1985      * @param lookup ignored
1986      * @return the {@linkplain Long} instance
1987      * @since 12
1988      */
1989     @Override
1990     public Long resolveConstantDesc(MethodHandles.Lookup lookup) {
1991         return this;
< prev index next >