| 1 |
/* |
| 2 |
* Copyright (C) 2021 The Android Open Source Project |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
package java.util; |
| 17 |
import java.util.function.LongConsumer; |
| 18 |
import java.util.function.LongSupplier; |
| 19 |
import java.util.function.Supplier; |
| 20 |
import java.util.stream.LongStream; |
| 21 |
public final class OptionalLong { |
| 22 |
// Make sure we have a <clinit> function since the real implementation of OptionalLong does. |
| 23 |
static { EMPTY = null; } |
| 24 |
private static final OptionalLong EMPTY; |
| 25 |
private final boolean isPresent; |
| 26 |
private final long value; |
| 27 |
private OptionalLong() { isPresent = false; value = 0; } |
| 28 |
private OptionalLong(long l) { this(); } |
| 29 |
public static OptionalLong empty() { return null; } |
| 30 |
public static OptionalLong of(long value) { return null; } |
| 31 |
public long getAsLong() { return 0; } |
| 32 |
public boolean isPresent() { return false; } |
| 33 |
public boolean isEmpty() { return false; } |
| 34 |
public void ifPresent(LongConsumer c) { } |
| 35 |
public void ifPresentOrElse(LongConsumer action, Runnable emptyAction) { } |
| 36 |
public LongStream stream() { return null; } |
| 37 |
public long orElse(long l) { return 0; } |
| 38 |
public long orElseGet(LongSupplier s) { return 0; } |
| 39 |
public long orElseThrow() { return 0; } |
| 40 |
public<X extends Throwable> long orElseThrow(Supplier<? extends X> s) throws X { return 0; } |
| 41 |
public boolean equals(Object o) { return false; } |
| 42 |
public int hashCode() { return 0; } |
| 43 |
public String toString() { return "Redefined OptionalLong!"; } |
| 44 |
} |