blob: b22c8a8a8b1c00d7d1e6b32cd02431b07b7106aa [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (19) -->
<title>WeakHashSet (Apache SIS 1.3 API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.sis.util.collection, class: WeakHashSet">
<meta name="generator" content="javadoc/ClassWriterImpl">
<meta name="keywords" content="org.apache.sis.util.collection.WeakHashSet class">
<meta name="keywords" content="getElementType()">
<meta name="keywords" content="size()">
<meta name="keywords" content="add()">
<meta name="keywords" content="remove()">
<meta name="keywords" content="get()">
<meta name="keywords" content="contains()">
<meta name="keywords" content="unique()">
<meta name="keywords" content="clear()">
<meta name="keywords" content="toArray()">
<meta name="keywords" content="iterator()">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../sis.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.6.0.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="class-use/WeakHashSet.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
<ul class="sub-nav-list-small">
<li>
<p>Summary:</p>
<ul>
<li>Nested</li>
<li>Field</li>
<li><a href="#constructor-summary">Constr</a></li>
<li><a href="#method-summary">Method</a></li>
</ul>
</li>
<li>
<p>Detail:</p>
<ul>
<li>Field</li>
<li><a href="#constructor-detail">Constr</a></li>
<li><a href="#method-detail">Method</a></li>
</ul>
</li>
</ul>
</div>
<div class="sub-nav">
<div id="navbar-sub-list">
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor-detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><a href="../../../../../search.html">SEARCH</a>
<input type="text" id="search-input" disabled placeholder="Search">
<input type="reset" id="reset-button" disabled value="reset">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.sis.util.collection</a></div>
<h1 title="Class WeakHashSet" class="title">Class WeakHashSet&lt;E&gt;</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>
<div class="inheritance"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">AbstractCollection</a>&lt;E&gt;
<div class="inheritance"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractSet.html" title="class or interface in java.util" class="external-link">AbstractSet</a>&lt;E&gt;
<div class="inheritance">WeakHashSet&lt;E&gt;</div>
</div>
</div>
</div>
<section class="class-description" id="class-description">
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>E</code> - the type of elements in the set.</dd>
</dl>
<dl class="notes">
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Iterable.html" title="class or interface in java.lang" class="external-link">Iterable</a>&lt;E&gt;</code>, <code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;E&gt;</code>, <code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;E&gt;</code>, <code><a href="CheckedContainer.html" title="interface in org.apache.sis.util.collection">Checked­Container</a>&lt;E&gt;</code></dd>
</dl>
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">WeakHashSet&lt;E&gt;</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractSet.html" title="class or interface in java.util" class="external-link">AbstractSet</a>&lt;E&gt;
implements <a href="CheckedContainer.html" title="interface in org.apache.sis.util.collection">CheckedContainer</a>&lt;E&gt;</span></div>
<div class="block">A set of objects hold by weak references. An entry in a <code>Weak­Hash­Set</code> will automatically
be removed when it is no longer in ordinary use. More precisely, the presence of an entry will
not prevent the entry from being discarded by the garbage collector, that is, made finalizable,
finalized, and then reclaimed. When an entry has been discarded it is effectively removed from
the set, so this class behaves somewhat differently than other <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link"><code>Set</code></a> implementations.
<p>If the elements stored in this set are arrays like <code>int[]</code>, <code>float[]</code> or
<code>Object[]</code>, then the hash code computations and the comparisons are performed using
the static <code>hash­Code(a)</code> and <code>equals(a1, a2)</code> methods defined in the <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Arrays.html" title="class or interface in java.util" class="external-link"><code>Arrays</code></a>
class.</p>
<h2>Optimizing memory use in factory implementations</h2>
The <code>Weak­Hash­Set</code> class has a <a href="#get(java.lang.Object)"><code>get(Object)</code></a> method that is not part of the
<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link"><code>Set</code></a> interface. This <code>get</code> method retrieves an entry from this set
that is equal to the supplied object. The <a href="#unique(T)"><code>unique(Object)</code></a> method combines a
<code>get</code> followed by a <code>add</code> operation if the specified object was not in the set.
This is similar in spirit to the <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/String.html#intern()" title="class or interface in java.lang" class="external-link"><code>String​.intern()</code></a> method. The following example shows
a convenient way to use <code>Weak­Hash­Set</code> as an internal pool of immutable objects:
<blockquote><pre><font color="green">private</font> <font color="green">final</font> WeakHashSet&lt;Foo&gt; pool = <font color="green">new</font> WeakHashSet&lt;Foo&gt;(Foo.<font color="green">class</font>);
<font color="green">public</font> Foo <b>create</b>(String definition) {
Foo created = <font color="green">new</font> <b>Foo</b>(definition);
<font color="green">return</font> pool.<b>unique</b>(created);
}</pre></blockquote>
Thus, <code>Weak­Hash­Set</code> can be used inside a factory to prevent creating duplicate immutable objects.
<h2>Thread safety</h2>
The same <code>Weak­Hash­Set</code> instance can be safely used by many threads without synchronization on the part of
the caller. But if a sequence of two or more method calls need to appear atomic from other threads perspective,
then the caller can synchronize on <code>this</code>.</div>
<dl class="notes">
<dt>Since:</dt>
<dd>0.3</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/WeakHashMap.html" title="class or interface in java.util" class="external-link"><code>Weak­Hash­Map</code></a></li>
</ul>
</dd>
<p><font size="-1">Defined in the <code>sis-utility</code> module</font></p>
</dl>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(java.lang.Class)" class="member-name-link">Weak­Hash­Set</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;&nbsp;type)</code></div>
<div class="col-last even-row-color">
<div class="block">Creates a <code>Weak­Hash­Set</code> for elements of the specified type.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#add(E)" class="member-name-link">add</a><wbr>(<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&nbsp;element)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Adds the specified element to this set if it is not already present.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#clear()" class="member-name-link">clear</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Removes all of the elements from this set.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#contains(java.lang.Object)" class="member-name-link">contains</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;element)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns <code>true</code> if this set contains the specified element.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#get(java.lang.Object)" class="member-name-link">get</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;element)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns an object equals to the specified object, if present.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#getElementType()" class="member-name-link">get­Element­Type</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the type of elements in this set.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Iterator.html" title="class or interface in java.util" class="external-link">Iterator</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#iterator()" class="member-name-link">iterator</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns an iterator over the elements contained in this collection.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#remove(java.lang.Object)" class="member-name-link">remove</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;element)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Removes a single instance of the specified element from this set, if it is present
Null values are considered never present.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>int</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#size()" class="member-name-link">size</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the count of element in this set.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#toArray()" class="member-name-link">to­Array</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns a view of this set as an array.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>&lt;T extends <a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;<br>T</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#unique(T)" class="member-name-link">unique</a><wbr>(T&nbsp;element)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns an object equals to <code>element</code> if such an object already exist in this
<code>Weak­Hash­Set</code>.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-AbstractSet">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractSet.html" title="class or interface in java.util" class="external-link">AbstractSet</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractSet.html#equals(java.lang.Object)" title="class or interface in java.util" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractSet.html#hashCode()" title="class or interface in java.util" class="external-link">hash­Code</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractSet.html#removeAll(java.util.Collection)" title="class or interface in java.util" class="external-link">remove­All</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-AbstractCollection">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">AbstractCollection</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#addAll(java.util.Collection)" title="class or interface in java.util" class="external-link">add­All</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#containsAll(java.util.Collection)" title="class or interface in java.util" class="external-link">contains­All</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#isEmpty()" title="class or interface in java.util" class="external-link">is­Empty</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#retainAll(java.util.Collection)" title="class or interface in java.util" class="external-link">retain­All</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#toArray(T%5B%5D)" title="class or interface in java.util" class="external-link">to­Array</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#toString()" title="class or interface in java.util" class="external-link">to­String</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">get­Class</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notify­All</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Collection">Methods inherited from interface&nbsp;<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#parallelStream()" title="class or interface in java.util" class="external-link">parallel­Stream</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#removeIf(java.util.function.Predicate)" title="class or interface in java.util" class="external-link">remove­If</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#stream()" title="class or interface in java.util" class="external-link">stream</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#toArray(java.util.function.IntFunction)" title="class or interface in java.util" class="external-link">to­Array</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Iterable">Methods inherited from interface&nbsp;<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Iterable.html" title="class or interface in java.lang" class="external-link">Iterable</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Iterable.html#forEach(java.util.function.Consumer)" title="class or interface in java.lang" class="external-link">for­Each</a></code></div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-Set">Methods inherited from interface&nbsp;<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#addAll(java.util.Collection)" title="class or interface in java.util" class="external-link">add­All</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#containsAll(java.util.Collection)" title="class or interface in java.util" class="external-link">contains­All</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#isEmpty()" title="class or interface in java.util" class="external-link">is­Empty</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#retainAll(java.util.Collection)" title="class or interface in java.util" class="external-link">retain­All</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#spliterator()" title="class or interface in java.util" class="external-link">spliterator</a>, <a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#toArray(T%5B%5D)" title="class or interface in java.util" class="external-link">to­Array</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(java.lang.Class)">
<h3>WeakHashSet</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">WeakHashSet</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;&nbsp;type)</span></div>
<div class="block">Creates a <code>Weak­Hash­Set</code> for elements of the specified type.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>type</code> - the type of the element to be included in this set.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="getElementType()">
<h3>getElementType</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link">Class</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</span>&nbsp;<span class="element-name">getElementType</span>()</div>
<div class="block">Returns the type of elements in this set.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="CheckedContainer.html#getElementType()">get­Element­Type</a></code>&nbsp;in interface&nbsp;<code><a href="CheckedContainer.html" title="interface in org.apache.sis.util.collection">Checked­Container</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Returns:</dt>
<dd>the element type.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="size()">
<h3>size</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">size</span>()</div>
<div class="block">Returns the count of element in this set.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#size()" title="class or interface in java.util" class="external-link">size</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#size()" title="class or interface in java.util" class="external-link">size</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#size()" title="class or interface in java.util" class="external-link">size</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">Abstract­Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Returns:</dt>
<dd>number of elements in this set.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="add(E)">
<h3 id="add(java.lang.Object)">add</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">add</span><wbr><span class="parameters">(<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&nbsp;element)</span>
throws <span class="exceptions"><a href="../NullArgumentException.html" title="class in org.apache.sis.util">NullArgumentException</a></span></div>
<div class="block">Adds the specified element to this set if it is not already present.
If this set already contains the specified element, the call leaves
this set unchanged and returns <code>false</code>.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#add(E)" title="class or interface in java.util" class="external-link">add</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#add(E)" title="class or interface in java.util" class="external-link">add</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#add(E)" title="class or interface in java.util" class="external-link">add</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">Abstract­Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Parameters:</dt>
<dd><code>element</code> - element to be added to this set.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if this set did not already contain the specified element.</dd>
<dt>Throws:</dt>
<dd><code><a href="../NullArgumentException.html" title="class in org.apache.sis.util">Null­Argument­Exception</a></code> - if the given object is <code>null</code>.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="remove(java.lang.Object)">
<h3>remove</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">remove</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;element)</span></div>
<div class="block">Removes a single instance of the specified element from this set, if it is present
Null values are considered never present.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#remove(java.lang.Object)" title="class or interface in java.util" class="external-link">remove</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#remove(java.lang.Object)" title="class or interface in java.util" class="external-link">remove</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#remove(java.lang.Object)" title="class or interface in java.util" class="external-link">remove</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">Abstract­Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Parameters:</dt>
<dd><code>element</code> - element to be removed from this set, if present. Can be <code>null</code>.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if the set contained the specified element.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="get(java.lang.Object)">
<h3>get</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a></span>&nbsp;<span class="element-name">get</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;element)</span></div>
<div class="block">Returns an object equals to the specified object, if present. If this set doesn't
contain any object equals to <code>element</code>, then this method returns <code>null</code>.
Null values are considered never present.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>element</code> - the element to get.</dd>
<dt>Returns:</dt>
<dd>an element equals to the given one if already presents in the set,
or <code>null</code> otherwise.</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="#unique(T)"><code>unique(Object)</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="contains(java.lang.Object)">
<h3>contains</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">contains</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a>&nbsp;element)</span></div>
<div class="block">Returns <code>true</code> if this set contains the specified element.
Null values are considered never present.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#contains(java.lang.Object)" title="class or interface in java.util" class="external-link">contains</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#contains(java.lang.Object)" title="class or interface in java.util" class="external-link">contains</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#contains(java.lang.Object)" title="class or interface in java.util" class="external-link">contains</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">Abstract­Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Parameters:</dt>
<dd><code>element</code> - object to be checked for containment in this set. Can be <code>null</code>.</dd>
<dt>Returns:</dt>
<dd><code>true</code> if this set contains the specified element.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="unique(T)">
<h3 id="unique(java.lang.Object)">unique</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="type-parameters">&lt;T extends <a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</span>&nbsp;<span class="return-type">T</span>&nbsp;<span class="element-name">unique</span><wbr><span class="parameters">(T&nbsp;element)</span></div>
<div class="block">Returns an object equals to <code>element</code> if such an object already exist in this
<code>Weak­Hash­Set</code>. Otherwise, adds <code>element</code> to this <code>Weak­Hash­Set</code>.
This method is functionally equivalents to the following code:
<blockquote><pre><font color="green">if</font> (element != <font color="green">null</font>) {
T current = <b>get</b>(element);
<font color="green">if</font> (current != <font color="green">null</font>) {
<font color="green">return</font> current;
} <font color="green">else</font> {
<b>add</b>(element);
}
}
<font color="green">return</font> element;</pre></blockquote></div>
<dl class="notes">
<dt>Type Parameters:</dt>
<dd><code>T</code> - the type of the element to get. Can be <code>null</code>.</dd>
<dt>Parameters:</dt>
<dd><code>element</code> - the element to get or to add in the set if not already presents,
or <code>null</code> if the given element was null.</dd>
<dt>Returns:</dt>
<dd>an element equals to the given one if already presents in the set,
or the given <code>object</code> otherwise.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="clear()">
<h3>clear</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">clear</span>()</div>
<div class="block">Removes all of the elements from this set.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#clear()" title="class or interface in java.util" class="external-link">clear</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#clear()" title="class or interface in java.util" class="external-link">clear</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#clear()" title="class or interface in java.util" class="external-link">clear</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">Abstract­Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="toArray()">
<h3>toArray</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>[]</span>&nbsp;<span class="element-name">toArray</span>()</div>
<div class="block">Returns a view of this set as an array. Elements will be in an arbitrary
order. Note that this array contains strong references. Consequently, no
object reclamation will occur as long as a reference to this array is hold.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#toArray()" title="class or interface in java.util" class="external-link">to­Array</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#toArray()" title="class or interface in java.util" class="external-link">to­Array</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Overrides:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#toArray()" title="class or interface in java.util" class="external-link">to­Array</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">Abstract­Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Returns:</dt>
<dd>all elements in this set.</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="iterator()">
<h3>iterator</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Iterator.html" title="class or interface in java.util" class="external-link">Iterator</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</span>&nbsp;<span class="element-name">iterator</span>()</div>
<div class="block">Returns an iterator over the elements contained in this collection.
No element from this set will be garbage collected as long as a
reference to the iterator is hold.</div>
<dl class="notes">
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html#iterator()" title="class or interface in java.util" class="external-link">iterator</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Collection.html" title="class or interface in java.util" class="external-link">Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Iterable.html#iterator()" title="class or interface in java.lang" class="external-link">iterator</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/Iterable.html" title="class or interface in java.lang" class="external-link">Iterable</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html#iterator()" title="class or interface in java.util" class="external-link">iterator</a></code>&nbsp;in interface&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/Set.html" title="class or interface in java.util" class="external-link">Set</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Specified by:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html#iterator()" title="class or interface in java.util" class="external-link">iterator</a></code>&nbsp;in class&nbsp;<code><a href="https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/util/AbstractCollection.html" title="class or interface in java.util" class="external-link">Abstract­Collection</a>&lt;<a href="WeakHashSet.html" title="type parameter in WeakHashSet">E</a>&gt;</code></dd>
<dt>Returns:</dt>
<dd>an iterator over all elements in this set.</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2010&#x2013;2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>