2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.access.client;
10 import com.google.common.annotations.Beta;
11 import java.util.AbstractQueue;
12 import java.util.Collections;
13 import java.util.Iterator;
14 import java.util.Queue;
15 import org.opendaylight.yangtools.concepts.Immutable;
18 * A specialized always-empty implementation of {@link java.util.Queue}. This implementation will always refuse new
19 * elements in its {@link #offer(Object)} method.
21 * @author Robert Varga
23 * @param <E> the type of elements held in this collection
25 // TODO: move this class into yangtools.util
27 public final class EmptyQueue<E> extends AbstractQueue<E> implements Immutable {
28 private static final EmptyQueue<?> INSTANCE = new EmptyQueue<>();
30 private EmptyQueue() {
34 @SuppressWarnings("unchecked")
35 public static <T> Queue<T> getInstance() {
36 return (Queue<T>) INSTANCE;
40 public boolean offer(final E entry) {
55 public Iterator<E> iterator() {
56 return Collections.emptyIterator();