This document provides an overview of Java's collections framework. It introduces common data structures like lists, sets, maps and their implementations including ArrayList, LinkedList, HashSet, TreeSet and HashMap. It explains how iterators work and how to traverse collections. The key interfaces like Collection, List, Set and Map are described along with their common methods. Examples of using different collections and their performance characteristics are also provided.
This presentation introduces some concepts about the Java Collection framework. These slides introduce the following concepts:
- Collections and iterators
- Linked list and array list
- Hash set and tree set
- Maps
- The collection framework
The presentation is took from the Java course I run in the bachelor-level informatics curriculum at the University of Padova.
This presentation introduces some concepts about the Java Collection framework. These slides introduce the following concepts:
- Collections and iterators
- Linked list and array list
- Hash set and tree set
- Maps
- The collection framework
The presentation is took from the Java course I run in the bachelor-level informatics curriculum at the University of Padova.
Number 1 I have completed and number 6 is just uploading I .pdfadvancethchnologies
Number 1 I have completed and number 6 is just uploading. I just need some help with the 2,3,4
and 5.
This is my code from Vector.cs:
using System;
using System.Collections.Generic;
using System.Text;
namespace Vector
{
public class Vector<T>
{
// This constant determines the default number of elements in a newly created vector.
// It is also used to extended the capacity of the existing vector
private const int DEFAULT_CAPACITY = 10;
// This array represents the internal data structure wrapped by the vector class.
// In fact, all the elements are to be stored in this private array.
// You will just write extra functionality (methods) to make the work with the array more convenient
for the user.
private T[] data;
// This property represents the number of elements in the vector
public int Count { get; private set; } = 0;
// This property represents the maximum number of elements (capacity) in the vector
public int Capacity
{
get { return data.Length; }
}
// This is an overloaded constructor
public Vector(int capacity)
{
data = new T[capacity];
}
// This is the implementation of the default constructor
public Vector() : this(DEFAULT_CAPACITY) { }
// An Indexer is a special type of property that allows a class or structure to be accessed the same
way as array for its internal collection.
// For example, introducing the following indexer you may address an element of the vector as
vector[i] or vector[0] or ...
public T this[int index]
{
get
{
if (index >= Count || index < 0) throw new IndexOutOfRangeException();
return data[index];
}
set
{
if (index >= Count || index < 0) throw new IndexOutOfRangeException();
data[index] = value;
}
}
// This private method allows extension of the existing capacity of the vector by another
'extraCapacity' elements.
// The new capacity is equal to the existing one plus 'extraCapacity'.
// It copies the elements of 'data' (the existing array) to 'newData' (the new array), and then makes
data pointing to 'newData'.
private void ExtendData(int extraCapacity)
{
T[] newData = new T[Capacity + extraCapacity];
for (int i = 0; i < Count; i++) newData[i] = data[i];
data = newData;
}
// This method adds a new element to the existing array.
// If the internal array is out of capacity, its capacity is first extended to fit the new element.
public void Add(T element)
{
if (Count == Capacity) ExtendData(DEFAULT_CAPACITY);
data[Count] = element;
Count++;
}
// This method searches for the specified object and returns the zerobased index of the first
occurrence within the entire data structure.
// This method performs a linear search; therefore, this method is an O(n) runtime complexity
operation.
// If occurrence is not found, then the method returns 1.
// Note that Equals is the proper method to compare two objects for equality, you must not use
operator '=' for this purpose.
public int IndexOf(T element)
{
for (var i = 0; i < Count; i++)
{
if (data[i].Equals(element)) return i;
}
return -1;
}
// TODO: Your task is to implement a.
To learn important concept of Collection and its handling plus its advantages and different class & child class of Collection and their implementations. Important interview questions of the collection.
In this session you will learn:
List – ArrayList, LinkedList
Set – HashSet, LinkedHashSet, TreeSet
For more information: https://www.mindsmapped.com/courses/software-development/become-a-java-developer-hands-on-training/
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
Number 1 I have completed and number 6 is just uploading I .pdfadvancethchnologies
Number 1 I have completed and number 6 is just uploading. I just need some help with the 2,3,4
and 5.
This is my code from Vector.cs:
using System;
using System.Collections.Generic;
using System.Text;
namespace Vector
{
public class Vector<T>
{
// This constant determines the default number of elements in a newly created vector.
// It is also used to extended the capacity of the existing vector
private const int DEFAULT_CAPACITY = 10;
// This array represents the internal data structure wrapped by the vector class.
// In fact, all the elements are to be stored in this private array.
// You will just write extra functionality (methods) to make the work with the array more convenient
for the user.
private T[] data;
// This property represents the number of elements in the vector
public int Count { get; private set; } = 0;
// This property represents the maximum number of elements (capacity) in the vector
public int Capacity
{
get { return data.Length; }
}
// This is an overloaded constructor
public Vector(int capacity)
{
data = new T[capacity];
}
// This is the implementation of the default constructor
public Vector() : this(DEFAULT_CAPACITY) { }
// An Indexer is a special type of property that allows a class or structure to be accessed the same
way as array for its internal collection.
// For example, introducing the following indexer you may address an element of the vector as
vector[i] or vector[0] or ...
public T this[int index]
{
get
{
if (index >= Count || index < 0) throw new IndexOutOfRangeException();
return data[index];
}
set
{
if (index >= Count || index < 0) throw new IndexOutOfRangeException();
data[index] = value;
}
}
// This private method allows extension of the existing capacity of the vector by another
'extraCapacity' elements.
// The new capacity is equal to the existing one plus 'extraCapacity'.
// It copies the elements of 'data' (the existing array) to 'newData' (the new array), and then makes
data pointing to 'newData'.
private void ExtendData(int extraCapacity)
{
T[] newData = new T[Capacity + extraCapacity];
for (int i = 0; i < Count; i++) newData[i] = data[i];
data = newData;
}
// This method adds a new element to the existing array.
// If the internal array is out of capacity, its capacity is first extended to fit the new element.
public void Add(T element)
{
if (Count == Capacity) ExtendData(DEFAULT_CAPACITY);
data[Count] = element;
Count++;
}
// This method searches for the specified object and returns the zerobased index of the first
occurrence within the entire data structure.
// This method performs a linear search; therefore, this method is an O(n) runtime complexity
operation.
// If occurrence is not found, then the method returns 1.
// Note that Equals is the proper method to compare two objects for equality, you must not use
operator '=' for this purpose.
public int IndexOf(T element)
{
for (var i = 0; i < Count; i++)
{
if (data[i].Equals(element)) return i;
}
return -1;
}
// TODO: Your task is to implement a.
To learn important concept of Collection and its handling plus its advantages and different class & child class of Collection and their implementations. Important interview questions of the collection.
In this session you will learn:
List – ArrayList, LinkedList
Set – HashSet, LinkedHashSet, TreeSet
For more information: https://www.mindsmapped.com/courses/software-development/become-a-java-developer-hands-on-training/
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfJay Das
With the advent of artificial intelligence or AI tools, project management processes are undergoing a transformative shift. By using tools like ChatGPT, and Bard organizations can empower their leaders and managers to plan, execute, and monitor projects more effectively.
A Comprehensive Look at Generative AI in Retail App Testing.pdfkalichargn70th171
Traditional software testing methods are being challenged in retail, where customer expectations and technological advancements continually shape the landscape. Enter generative AI—a transformative subset of artificial intelligence technologies poised to revolutionize software testing.
Check out the webinar slides to learn more about how XfilesPro transforms Salesforce document management by leveraging its world-class applications. For more details, please connect with sales@xfilespro.com
If you want to watch the on-demand webinar, please click here: https://www.xfilespro.com/webinars/salesforce-document-management-2-0-smarter-faster-better/
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
COVID-19 had an unprecedented impact on scientific collaboration. The pandemic and its broad response from the scientific community has forged new relationships among public health practitioners, mathematical modelers, and scientific computing specialists, while revealing critical gaps in exploiting advanced computing systems to support urgent decision making. Informed by our team’s work in applying high-performance computing in support of public health decision makers during the COVID-19 pandemic, we present how Globus technologies are enabling the development of an open science platform for robust epidemic analysis, with the goal of collaborative, secure, distributed, on-demand, and fast time-to-solution analyses to support public health.
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxrickgrimesss22
Discover the essential features to incorporate in your Winzo clone app to boost business growth, enhance user engagement, and drive revenue. Learn how to create a compelling gaming experience that stands out in the competitive market.
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Navigating the Metaverse: A Journey into Virtual Evolution"Donna Lenk
Join us for an exploration of the Metaverse's evolution, where innovation meets imagination. Discover new dimensions of virtual events, engage with thought-provoking discussions, and witness the transformative power of digital realms."
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisGlobus
JASMIN is the UK’s high-performance data analysis platform for environmental science, operated by STFC on behalf of the UK Natural Environment Research Council (NERC). In addition to its role in hosting the CEDA Archive (NERC’s long-term repository for climate, atmospheric science & Earth observation data in the UK), JASMIN provides a collaborative platform to a community of around 2,000 scientists in the UK and beyond, providing nearly 400 environmental science projects with working space, compute resources and tools to facilitate their work. High-performance data transfer into and out of JASMIN has always been a key feature, with many scientists bringing model outputs from supercomputers elsewhere in the UK, to analyse against observational or other model data in the CEDA Archive. A growing number of JASMIN users are now realising the benefits of using the Globus service to provide reliable and efficient data movement and other tasks in this and other contexts. Further use cases involve long-distance (intercontinental) transfers to and from JASMIN, and collecting results from a mobile atmospheric radar system, pushing data to JASMIN via a lightweight Globus deployment. We provide details of how Globus fits into our current infrastructure, our experience of the recent migration to GCSv5.4, and of our interest in developing use of the wider ecosystem of Globus services for the benefit of our user community.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
The U.S. Geological Survey (USGS) has made substantial investments in meeting evolving scientific, technical, and policy driven demands on storing, managing, and delivering data. As these demands continue to grow in complexity and scale, the USGS must continue to explore innovative solutions to improve its management, curation, sharing, delivering, and preservation approaches for large-scale research data. Supporting these needs, the USGS has partnered with the University of Chicago-Globus to research and develop advanced repository components and workflows leveraging its current investment in Globus. The primary outcome of this partnership includes the development of a prototype enterprise repository, driven by USGS Data Release requirements, through exploration and implementation of the entire suite of the Globus platform offerings, including Globus Flow, Globus Auth, Globus Transfer, and Globus Search. This presentation will provide insights into this research partnership, introduce the unique requirements and challenges being addressed and provide relevant project progress.
top nidhi software solution freedownloadvrstrong314
This presentation emphasizes the importance of data security and legal compliance for Nidhi companies in India. It highlights how online Nidhi software solutions, like Vector Nidhi Software, offer advanced features tailored to these needs. Key aspects include encryption, access controls, and audit trails to ensure data security. The software complies with regulatory guidelines from the MCA and RBI and adheres to Nidhi Rules, 2014. With customizable, user-friendly interfaces and real-time features, these Nidhi software solutions enhance efficiency, support growth, and provide exceptional member services. The presentation concludes with contact information for further inquiries.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Cyaniclab : Software Development Agency Portfolio.pdfCyanic lab
CyanicLab, an offshore custom software development company based in Sweden,India, Finland, is your go-to partner for startup development and innovative web design solutions. Our expert team specializes in crafting cutting-edge software tailored to meet the unique needs of startups and established enterprises alike. From conceptualization to execution, we offer comprehensive services including web and mobile app development, UI/UX design, and ongoing software maintenance. Ready to elevate your business? Contact CyanicLab today and let us propel your vision to success with our top-notch IT solutions.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
The Earth System Grid Federation (ESGF) is a global network of data servers that archives and distributes the planet’s largest collection of Earth system model output for thousands of climate and environmental scientists worldwide. Many of these petabyte-scale data archives are located in proximity to large high-performance computing (HPC) or cloud computing resources, but the primary workflow for data users consists of transferring data, and applying computations on a different system. As a part of the ESGF 2.0 US project (funded by the United States Department of Energy Office of Science), we developed pre-defined data workflows, which can be run on-demand, capable of applying many data reduction and data analysis to the large ESGF data archives, transferring only the resultant analysis (ex. visualizations, smaller data files). In this talk, we will showcase a few of these workflows, highlighting how Globus Flows can be used for petabyte-scale climate analysis.
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
Keep tabs on your field staff effortlessly with Informap Technology Centre LLC. Real-time tracking, task assignment, and smart features for efficient management. Request a live demo today!
For more details, visit us : https://informapuae.com/field-staff-tracking/
RISE with SAP and Journey to the Intelligent Enterprise
LJ_JAVA_FS_Collection.pptx
1.
2.
3. Introduction
Collections and iterators
Linked list
Array list
Hash set
Tree set
Maps
Collections framework
4. Data structures can make a big difference in programming
⚫ Do you need to search quickly? Do you need to rapidly insert and remove element? ...
The first version of Java was supplied with a very small set of classes
⚫ Vector, Stack, Hashtable, BitSet and Enumeration
⚫ Java needed a serious data structure library
Without the complexity of C++ STL(Standard Template Library)
With the benefit of «generic algorithms» of C++ STL
⚫ The collections framework satisfies those needs
5. Java collection framework separates interfaces and implementations
⚫ It defines a set of interfaces that represents abstract data structures
⚫ Each interface is then implemented in different ways,
each with main focus on some aspects
For example, fast insertion, fast search, fixed memory consumption, ...
⚫ Using interfaces, you can change the implementation
simply modifying a single statement
// ArrayList optimizes random access, LinkedList modification stmts
List<Integer> list = new ArrayList<>();
list = new LinkedList<>()
6.
7. The fundamental interface for collection is the
Collection interface
⚫ The add method adds an element ot the collection
Returns true if the collection was changed by the addition
⚫ Iterators are used visit elements in the collection
Implements the Iterator design pattern
public interface Collection<E> {
boolean add(E element);
Iterator<E> iterator();
// ...
}
public interface Iterator<E> {
E next();
boolean hasNext();
void remove();
}
8. Using iterators we have decoupled a collection from the
traversing policies
⚫ The order in which elements are visited depends on the the collection
type
⚫ Using the next method the collection is visited one
element at time
If the end of the collection is reached an
NoSuchElementException is thrown
⚫ Use the hasNext method to check if the collection
has more elements to visit
⚫ Think of Java iterators as being between elements
The iterator jumps over the next element
9. Think of Java iterators as being
between elements
While moving, the iterator returns
the current element
10. Using next and hasNext it is possibile to
traverse the collection
⚫ As of Java 5, there is an elegant shortcut to looping a
collection using iterators
⚫ To use the for each loop the data structure must
implement Iterable<E> interface
for (String element : c) {
// do something with element
}
Collection<String> c = /* ... */;
Iterator<String> iter = c.iterator();
while (iter.hasNext()) {
String element = iter.next();
// do something with element
}
11. Using an iterator it possibile to remove elements
from a collection
⚫ The remove method removes the element that was
returned by the last call to next
There is a strong dependency between next and remove: it
is illegal to call remove if it wasn’t preceded by a call to next
⚫ This is the only way to safely modify a collection after
the creation of an iterator
for (Iterator<String> iterator = list.iterator();
iterator.hasNext();) {
// Point the iterator to the current element
String string = iterator.next();
iterator.remove();
}
12. All concrete collections implement Collection
or Map interfaces
⚫ We will introduce only few of them
Collection type Description
ArrayList An indexed sequence that grows and
shrinks dynamically
LinkedList An ordered sequence that allows efficient
insertion and removal at any location
HashSet An unordered collection that rejects
duplicates
TreeSet A sorted set
HashMap A data structure that stores key/value
associations
13. A LinkedList<E> is an ordered data structure
that stores each object in a link
⚫ Each link store a reference to the next link of the seq.
In Java, a linked list is always doubly linked
Implements List<E>
interface
14. Very efficient for remove and add operations
⚫ These ops are made through an Iterator
Other elements in the list have not to be repositioned after
removal of an element
15. Also di add operation is made efficiently
through an iterator of type ListIterator<E>
⚫ Use List.listIterator method to get one
⚫ New element is added before the current position of
the iterator
Be carefull of concurrent modification using iterators
Linked list are very inefficient in random access
interface ListIterator<E> extends Iterator<E> {
void add(E element);
E previous()
boolean hasPrevious()
}
for (int i = 0; i < list.size(); i++)
// do something with list.get(i);
16. Adding a new element
changes at most two
references
17. An ArrayList<E> is an ordered data structure
that is very efficient in random access ops.
⚫ It encapsulate a dynamically reallocated array of
objects
⚫ Adding and removing operation
are not so efficient
Reallocation of elements is needed
⚫ Use ArrayList instead of Vector
More efficient due to its not
synchronized methods
18.
19. A Set<E> is a data structure that doesn’t care
about element’s ordering
⚫ A set contain the same element only once
⚫ Search operation performs very efficiently
⚫ A set is a Collection
An HashSet<E> uses hash codes to distinguish
among elements
⚫ An hashCode is a number that can be derived from
object data
You must provide an hash function to your classes
The function must be compatible with the equals method
20. If the hash function produceds values
that are randomly distributed, collision
should be rare
buckets
21. An HashSet is implemented using an hash table
⚫ The contains method is very efficient, because it has
to lookup the element only in one bucket
⚫ An iterator to hash set visit each bucket in turn
Because of scattering, they are visited in a seemingly random
order
⚫ The add method adds an element if it is not already
present
Don’t mutate an element in a set once inserted
⚫ If the hash code of an element were to change, the
element would no longer be in the correct position
22. A TreeSet<E> is a sorted set
⚫ While iterating over the collection, the elements are
presented in sorted order
⚫ It uses a red-black tree to store data
Insertion is slower than insertion in an hash table, but it is
still much faster than insertion in an array or linked list
...but a tree set automatically sorts the elements ;)
⚫ The type of the elements may implement
Comparable<T>
public interface Comparable<T> {
// It returns a value that is < 0, = 0 or > 0
int compareTo(T other);
}
23. What if elements do not implement Comparable
or if you need more than on compation alg?
⚫ Provide a Comparator during set construction
The compare method acts like the compareTo method
Function object (lambda anyone?!)
Using an HashSet or a TreeSet?
⚫ There must be a total ordering defined on elements
You have to implement also the Comparator interface
⚫ Do you neeed elements to be sorted?
public interface Comparator<T> {
// Defines how two elements of type T have to be compared
int compare(T a, T b);
}
24.
25. A Map<K,V> is a data structure that allows you
to search an element using a key
⚫ A map stores key/value pairs
Key must be unique: If you call the put method twice with
the same key, the second value replaces the first one.
If no info is associated with a key, get returns null
In sets to find an element you must have a copy of it
⚫ An HashMap hashes the keys
// HashMap implements Map
Map<String, Employee> staff = new HashMap<>();
Employee harry = new Employee("Harry Hacker");
staff.put("987-98-9996", harry);
String s = "987-98-9996";
e = staff.get(s); // gets harry
26. The collection framework does not consider a
map itself as a Collection
⚫ It is possible to obtain views of the map
If you are interested in all the values of a map, loop over the
enumeration of its entries
Iterators on views cannot add elements to the map
An UnsupportedOperationException is thrown
Set<K> keySet() // Set of keys
Collection<K> values() // Collection of values
Set<Map.Entry<K, V>> entrySet() // Set of pairs (key,value)
for (Map.Entry<String, Employee> entry : staff.entrySet()) {
String key = entry.getKey();
Employee value = entry.getValue();
// do something with key, value
}
27. A framework is a set of classes that form the
basis for building advanced functionality
⚫ The Collection framework defines classes to
implement collections
⚫ The main interfaces are Collection and Map
Insertion interfaces are different between the two types
To get the elements from a Collection, just iterate over it
To get a value from a Map, use the get method
// To insert an element in a Collection
boolean add(E element)
// To store a key/value pair in a Map
V put(K key, V value)
V get(K key)
28. A List is an ordered collection
⚫ There is the concept of position of an element
A list provides random access methods
Lists provides a specialized iterator, ListIterator
A Set is a Collection with no duplicates
⚫ The add method can reject a value if already present
⚫ Methods equals and hashCode are used to maintain
elements inside the set
void add(int index, E element)
E get(int index)
void remove(int index)
void add(E element)
30. The framework have some companion objects
⚫ The Arrays type allows to trasform arrays into List
And so on...
static <T> List<T> asList(T... a)
The list returned is a view on the array: it is not possible to
change the size of the list; elements are the same
⚫ The Collections type have a bunch of utilities
The method nCopies builds an illusory immutable list
List<String> settings = Collections.nCopies(100, "DEFAULT");
Object is stored only once
Method singleton returns an illusory set with one element
Collections.singleton(anObject)