< prev index next >

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

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


1821      */
1822     public static int max(int a, int b) {
1823         return Math.max(a, b);
1824     }
1825 
1826     /**
1827      * Returns the smaller of two {@code int} values
1828      * as if by calling {@link Math#min(int, int) Math.min}.
1829      *
1830      * @param a the first operand
1831      * @param b the second operand
1832      * @return the smaller of {@code a} and {@code b}
1833      * @see java.util.function.BinaryOperator
1834      * @since 1.8
1835      */
1836     public static int min(int a, int b) {
1837         return Math.min(a, b);
1838     }
1839 
1840     /**
1841      * Returns a nominal descriptor for this instance, which is the instance
1842      * itself.
1843      *
1844      * @return an {@link Optional} describing the {@linkplain Integer} instance
1845      * @since 12
1846      */
1847     @Override
1848     public Optional<Integer> describeConstable() {
1849         return Optional.of(this);
1850     }
1851 
1852     /**
1853      * Resolves this instance as a {@link ConstantDesc}, the result of which is
1854      * the instance itself.
1855      *
1856      * @param lookup ignored
1857      * @return the {@linkplain Integer} instance
1858      * @since 12
1859      */
1860     @Override
1861     public Integer resolveConstantDesc(MethodHandles.Lookup lookup) {
1862         return this;


1821      */
1822     public static int max(int a, int b) {
1823         return Math.max(a, b);
1824     }
1825 
1826     /**
1827      * Returns the smaller of two {@code int} values
1828      * as if by calling {@link Math#min(int, int) Math.min}.
1829      *
1830      * @param a the first operand
1831      * @param b the second operand
1832      * @return the smaller of {@code a} and {@code b}
1833      * @see java.util.function.BinaryOperator
1834      * @since 1.8
1835      */
1836     public static int min(int a, int b) {
1837         return Math.min(a, b);
1838     }
1839 
1840     /**
1841      * Returns an {@link Optional} containing the nominal descriptor for this
1842      * instance, which is the instance itself.
1843      *
1844      * @return an {@link Optional} describing the {@linkplain Integer} instance
1845      * @since 12
1846      */
1847     @Override
1848     public Optional<Integer> describeConstable() {
1849         return Optional.of(this);
1850     }
1851 
1852     /**
1853      * Resolves this instance as a {@link ConstantDesc}, the result of which is
1854      * the instance itself.
1855      *
1856      * @param lookup ignored
1857      * @return the {@linkplain Integer} instance
1858      * @since 12
1859      */
1860     @Override
1861     public Integer resolveConstantDesc(MethodHandles.Lookup lookup) {
1862         return this;
< prev index next >