Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Hazelcast

You're reading from  Getting Started with Hazelcast

Product type Book
Published in Aug 2013
Publisher
ISBN-13 9781782167303
Pages 136 pages
Edition 1st Edition
Languages
Author (1):
Matthew Johns Matthew Johns
Profile icon Matthew Johns

Table of Contents (18) Chapters

Getting Started with Hazelcast
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
What is Hazelcast? Getting off the Ground Going Concurrent Divide and Conquer Listening Out Spreading the Load Typical Deployments From the Outside Looking In Going Global Playing Well with Others Configuration Summary Index

Sets, lists, and queues


In our previous examples, we have looked at key/value storage provided by Hazelcast maps; however, there are a number of other collections that provide keyless groups of objects. Two of these additional types are distributed versions of collections that we are hopefully already familiar with—sets and lists.

As we know, the primary difference between the two is that lists allow for multiple entries and a set does not. So if we add them to our previous map example, we get the following code:

Set<String> cities = hz.getSet("cities");
cities.addAll(captials.values());
cities.add("London");
cities.add("Rome");
cities.add("New York");

List<String> countries = hz.getList("countries");
countries.addAll(captials.keySet());
countries.add("CA");
countries.add("DE");
countries.add("GB"); // duplicate entry

In using our test console again to interact with these new collections, we will have to use different commands as we are now interacting with a set and a list rather...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}