Skip to content

Commit 1ba5015

Browse files
committed
Polish #161 : Update JavaDoc
1 parent f9c3eb9 commit 1ba5015

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

  • microsphere-java-core/src/main/java/io/microsphere/collection
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package io.microsphere.collection;
19+
20+
import java.io.Serializable;
21+
import java.util.Deque;
22+
import java.util.Iterator;
23+
24+
import static java.util.Collections.emptyIterator;
25+
26+
27+
/**
28+
* An empty and immutable implementation of the Deque interface.
29+
* <p>
30+
* This class implements a {@link Deque} that is always empty. All operations that attempt to modify the deque will result in an
31+
* {@link UnsupportedOperationException}. It is serializable and guarantees consistent behavior across different environments.
32+
* </p>
33+
*
34+
* @param <E> The type of elements held in this deque.
35+
* @author <a href="mailto:mercyblitz@gmail.com">Mercy</a>
36+
* @see AbstractDeque
37+
* @since 1.0.0
38+
*/
39+
public class EmptyDeque<E> extends AbstractDeque<E> implements Serializable {
40+
41+
private static final long serialVersionUID = -1L;
42+
43+
@Override
44+
public Iterator<E> iterator() {
45+
return emptyIterator();
46+
}
47+
48+
@Override
49+
public Iterator<E> descendingIterator() {
50+
return emptyIterator();
51+
}
52+
53+
@Override
54+
public boolean offerFirst(E e) {
55+
throw new UnsupportedOperationException();
56+
}
57+
58+
@Override
59+
public boolean offerLast(E e) {
60+
throw new UnsupportedOperationException();
61+
}
62+
63+
@Override
64+
public E pollFirst() {
65+
throw new UnsupportedOperationException();
66+
}
67+
68+
@Override
69+
public E pollLast() {
70+
throw new UnsupportedOperationException();
71+
}
72+
73+
@Override
74+
public E getFirst() {
75+
throw new UnsupportedOperationException();
76+
}
77+
78+
@Override
79+
public E getLast() {
80+
throw new UnsupportedOperationException();
81+
}
82+
83+
@Override
84+
public boolean removeLastOccurrence(Object o) {
85+
return false;
86+
}
87+
88+
@Override
89+
public int size() {
90+
return 0;
91+
}
92+
}

0 commit comments

Comments
 (0)