Package com.hazelcast.collection

Examples of com.hazelcast.collection.CollectionItem


        }
        return config;
    }

    protected CollectionItem add(int index, Data value) {
        final CollectionItem item = new CollectionItem(nextId(), value);
        if (index < 0) {
            return getCollection().add(item) ? item : null;
        } else {
            getCollection().add(index, item);
            return item;
View Full Code Here


    protected CollectionItem get(int index) {
        return getCollection().get(index);
    }

    protected CollectionItem set(int index, long itemId, Data value) {
        return getCollection().set(index, new CollectionItem(itemId, value));
    }
View Full Code Here

        return getCollection().set(index, new CollectionItem(itemId, value));
    }

    protected void setBackup(long oldItemId, long itemId, Data value) {
        getMap().remove(oldItemId);
        getMap().put(itemId, new CollectionItem(itemId, value));

    }
View Full Code Here

        final List<CollectionItem> list = getCollection();
        if (last) {
            int index = list.size();
            final ListIterator<CollectionItem> iterator = list.listIterator(index);
            while (iterator.hasPrevious()) {
                final CollectionItem item = iterator.previous();
                index--;
                if (value.equals(item.getValue())) {
                    return index;
                }
            }
        } else {
            int index = -1;
            for (CollectionItem item : list) {
                index++;
                if (value.equals(item.getValue())) {
                    return index;
                }
            }
        }
        return -1;
View Full Code Here

        final int size = valueList.size();
        final Map<Long, Data> map = new HashMap<Long, Data>(size);
        List<CollectionItem> list = new ArrayList<CollectionItem>(size);
        for (Data value : valueList) {
            final long itemId = nextId();
            list.add(new CollectionItem(itemId, value));
            map.put(itemId, value);
        }
        getCollection().addAll(index, list);

        return map;
View Full Code Here

        final ListContainer container = getOrCreateListContainer();
        response = false;
        if (!hasEnoughCapacity(1)) {
            return;
        }
        final CollectionItem item = container.add(index, value);
        if (item != null) {
            itemId = item.getItemId();
            response = true;
        }
    }
View Full Code Here

        publishEvent(ItemEventType.ADDED, (Data) response);
    }

    @Override
    public void run() throws Exception {
        final CollectionItem item = getOrCreateListContainer().remove(index);
        itemId = item.getItemId();
        response = item.getValue();
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.collection.CollectionItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.