1/*
2 * Copyright (C) 2007 Google Inc.
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
17package com.google.common.collect;
18
19import com.google.common.annotations.GwtCompatible;
20
21import java.util.Set;
22
23import javax.annotation.Nullable;
24
25/**
26 * A set which forwards all its method calls to another set. Subclasses should
27 * override one or more methods to modify the behavior of the backing set as
28 * desired per the <a
29 * href="http://en.wikipedia.org/wiki/Decorator_pattern">decorator pattern</a>.
30 *
31 * @see ForwardingObject
32 * @author Kevin Bourrillion
33 * @since 2010.01.04 <b>stable</b> (imported from Google Collections Library)
34 */
35@GwtCompatible
36public abstract class ForwardingSet<E> extends ForwardingCollection<E>
37    implements Set<E> {
38
39  @Override protected abstract Set<E> delegate();
40
41  @Override public boolean equals(@Nullable Object object) {
42    return object == this || delegate().equals(object);
43  }
44
45  @Override public int hashCode() {
46    return delegate().hashCode();
47  }
48}
49