PageRenderTime 15ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/hazelcast-client/src/main/java/com/hazelcast/client/ValueIterator.java

https://bitbucket.org/gabral6_gmailcom/hazelcast
Java | 45 lines | 22 code | 8 blank | 15 comment | 2 complexity | cc29e989e4175b68dab95edcaab14cd4 MD5 | raw file
 1/*
 2 * Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
 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.hazelcast.client;
18
19import java.util.Iterator;
20import java.util.Map.Entry;
21
22public class ValueIterator<K, V> implements Iterator<V> {
23
24    private final Iterator<Entry<K, V>> entryIterator;
25
26    public ValueIterator(Iterator<Entry<K, V>> entryIterator) {
27        this.entryIterator = entryIterator;
28    }
29
30    public boolean hasNext() {
31        return entryIterator.hasNext();
32    }
33
34    public V next() {
35        V next = entryIterator.next().getValue();
36        if (next == null) {
37            next = next();
38        }
39        return next;
40    }
41
42    public void remove() {
43        throw new UnsupportedOperationException();
44    }
45};