Package org.threadly.concurrent
Class ContainerHelper
- java.lang.Object
-
- org.threadly.concurrent.ContainerHelper
-
public final class ContainerHelper extends java.lang.Object
Typically used only internally by the threadly library. This class is designed to help with determining if a Runnable or Callable is contained at some point within a chain ofCallableContainer
orRunnableContainer
.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description ContainerHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<java.lang.Runnable>
getContainedRunnables(java.util.List<? extends RunnableContainer> sourceList)
Takes in a list of runnable containers, and instead makes a list of the runnables which are contained in each item of the list.static boolean
isContained(java.lang.Runnable startRunnable, java.lang.Runnable compareTo)
Checks if the start runnable equals the compareTo runnable, or if the compareTo runnable is contained within a wrapper of the startRunnable.static boolean
isContained(java.lang.Runnable startRunnable, java.util.concurrent.Callable<?> compareTo)
Checks if the start runnable contains the provided callable.static boolean
remove(java.util.Collection<? extends RunnableContainer> source, java.lang.Runnable compareTo)
Attempts to remove the provided runnable from the source collection.static boolean
remove(java.util.Collection<? extends RunnableContainer> source, java.util.concurrent.Callable<?> compareTo)
Attempts to remove the provided callable from the source collection.
-
-
-
Method Detail
-
remove
public static boolean remove(java.util.Collection<? extends RunnableContainer> source, java.lang.Runnable compareTo)
Attempts to remove the provided runnable from the source collection. This uses theCollection.remove(Object)
function to remove the container if it is found.- Parameters:
source
- source collection to search overcompareTo
- Runnable to compare against in search- Returns:
true
if collection was modified- Since:
- 2.0.0
-
remove
public static boolean remove(java.util.Collection<? extends RunnableContainer> source, java.util.concurrent.Callable<?> compareTo)
Attempts to remove the provided callable from the source collection. This uses theCollection.remove(Object)
function to remove the container if it is found.- Parameters:
source
- source collection to search overcompareTo
- Callable to compare against in search- Returns:
true
if collection was modified- Since:
- 2.0.0
-
isContained
public static boolean isContained(java.lang.Runnable startRunnable, java.lang.Runnable compareTo)
Checks if the start runnable equals the compareTo runnable, or if the compareTo runnable is contained within a wrapper of the startRunnable.- Parameters:
startRunnable
- runnable to start search atcompareTo
- runnable to be comparing against- Returns:
true
if they are equivalent, or the compareTo runnable is contained within the start
-
isContained
public static boolean isContained(java.lang.Runnable startRunnable, java.util.concurrent.Callable<?> compareTo)
Checks if the start runnable contains the provided callable.- Parameters:
startRunnable
- runnable to start search atcompareTo
- callable to be comparing against- Returns:
true
if the compareTo runnable is contained within the runnable
-
getContainedRunnables
public static java.util.List<java.lang.Runnable> getContainedRunnables(java.util.List<? extends RunnableContainer> sourceList)
Takes in a list of runnable containers, and instead makes a list of the runnables which are contained in each item of the list.- Parameters:
sourceList
- List of runnable containers to get interior runnable from- Returns:
- A list of runnables which were contained in the source list
- Since:
- 4.0.0
-
-