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;
OptionalLong()27   private OptionalLong() { isPresent = false; value = 0; }
OptionalLong(long l)28   private OptionalLong(long l) { this(); }
empty()29   public static OptionalLong empty() { return null; }
of(long value)30   public static OptionalLong of(long value) { return null; }
getAsLong()31   public long getAsLong() { return 0; }
isPresent()32   public boolean isPresent() { return false; }
isEmpty()33   public boolean isEmpty() { return false; }
ifPresent(LongConsumer c)34   public void ifPresent(LongConsumer c) { }
ifPresentOrElse(LongConsumer action, Runnable emptyAction)35   public void ifPresentOrElse(LongConsumer action, Runnable emptyAction) { }
stream()36   public LongStream stream() { return null; }
orElse(long l)37   public long orElse(long l) { return 0; }
orElseGet(LongSupplier s)38   public long orElseGet(LongSupplier s) { return 0; }
orElseThrow()39   public long orElseThrow() { return 0; }
orElseThrow(Supplier<? extends X> s)40   public<X extends Throwable> long orElseThrow(Supplier<? extends X> s) throws X { return 0; }
equals(Object o)41   public boolean equals(Object o) { return false; }
hashCode()42   public int hashCode() { return 0; }
toString()43   public String toString() { return "Redefined OptionalLong!"; }
44 }
45