Package com.cedarsoftware.util
Class CollectionUtilities
java.lang.Object
com.cedarsoftware.util.CollectionUtilities
- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
License
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
hasContent
(Collection col) This is a null-safe isEmpty check.static boolean
isEmpty
(Collection col) This is a null-safe isEmpty check.static <T> List<T>
listOf
(T... items) For JDK1.8 support.static <T> Set<T>
setOf
(T... items) For JDK1.8 support.static int
size
(Collection col) This is a null-safe size check.
-
Constructor Details
-
CollectionUtilities
public CollectionUtilities()
-
-
Method Details
-
isEmpty
This is a null-safe isEmpty check.- Parameters:
col
- Collection to check- Returns:
- true if empty or null
-
hasContent
This is a null-safe isEmpty check.- Parameters:
col
- Collection to check- Returns:
- true if empty or null
-
size
This is a null-safe size check.- Parameters:
col
- Collection to check- Returns:
- true if empty or null
-
listOf
For JDK1.8 support. Remove this and change to List.of() for JDK11+ -
setOf
For JDK1.8 support. Remove this and change to Set.of() for JDK11+
-