Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improve] [doc] Add doc for customized util class #21110

Merged
merged 5 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* <li>Open hash map with linear probing, no node allocations to store the values
* </ol>
*
* <b>WARN: method forEach do not guarantee thread safety, nor do the keys and values method.</b>
* @param <V>
*/
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -237,6 +238,12 @@ public void clear() {
}
}

/**
* Iterate over all the entries in the map and apply the processor function to each of them.
* <p>
* <b>Warning: Do Not Guarantee Thread-Safety.</b>
* @param processor the processor to apply to each entry
*/
thetumbled marked this conversation as resolved.
Show resolved Hide resolved
public void forEach(EntryProcessor<V> processor) {
for (int i = 0; i < sections.length; i++) {
sections[i].forEach(processor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
* no node allocations are required to store the keys and values, and no boxing is required.
*
* <p>Keys <strong>MUST</strong> be &gt;= 0.
* <br>
* <b>WARN: method forEach do not guarantee thread safety, nor do the keys and values method.</b>
*/
public class ConcurrentLongLongPairHashMap {

Expand Down Expand Up @@ -254,6 +256,12 @@ public void clear() {
}
}

/**
* Iterate over all the entries in the map and apply the processor function to each of them.
* <p>
* <b>Warning: Do Not Guarantee Thread-Safety.</b>
* @param processor the processor to process the elements.
*/
public void forEach(BiConsumerLongPair processor) {
for (Section s : sections) {
s.forEach(processor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
* no node allocations are required to store the keys and values, and no boxing is required.
*
* <p>Values <b>MUST</b> be &gt;= 0.
* <br>
* <b>WARN: method forEach do not guarantee thread safety, nor does the items method.</b>
*/
public class ConcurrentLongPairSet implements LongPairSet {

Expand Down Expand Up @@ -237,6 +239,12 @@ public void clear() {
}
}

/**
* Iterate over all the elements in the set and apply the provided function.
* <p>
* <b>Warning: Do Not Guarantee Thread-Safety.</b>
* @param processor the processor to process the elements
*/
public void forEach(LongPairConsumer processor) {
for (int i = 0; i < sections.length; i++) {
sections[i].forEach(processor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* <p>Provides similar methods as a {@code ConcurrentMap<K,V>} but since it's an open hash map with linear probing,
* no node allocations are required to store the values.
*
* <b>WARN: method forEach do not guarantee thread safety, nor do the keys and values method.</b>
* @param <V>
*/
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -272,6 +273,12 @@ public void clear() {
}
}

/**
* Iterate over all the entries in the map and apply the processor function to each of them.
* <p>
* <b>Warning: Do Not Guarantee Thread-Safety.</b>
* @param processor the function to apply to each entry
*/
public void forEach(BiConsumer<? super K, ? super V> processor) {
for (int i = 0; i < sections.length; i++) {
sections[i].forEach(processor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
* <p>Provides similar methods as a {@code ConcurrentMap<K,V>} but since it's an open hash map with linear probing,
* no node allocations are required to store the values.
*
* <br>
* <b>WARN: method forEach do not guarantee thread safety, nor does the items method.</b>
* @param <V>
*/
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -216,6 +218,12 @@ public void clear() {
}
}

/**
* Iterate over all the elements in the set and apply the provided function.
* <p>
* <b>Warning: Do Not Guarantee Thread-Safety.</b>
* @param processor the function to apply to each element
*/
public void forEach(Consumer<? super V> processor) {
for (int i = 0; i < sections.length; i++) {
sections[i].forEach(processor);
Expand Down