IterUtil

Source

The methods in this utility class were originally in CollUtil, but they were extracted and abstracted to adapt to a wider range of scenarios.

Method Introduction

  • isEmpty Whether it is null or empty
  • isNotEmpty Whether it is non-null and contains at least one element
  • hasNull Whether there are null elements
  • isAllNull Whether all elements are null
  • countMap Returns a Map of element counts based on a collection. Element counts refer to the number of times an element appears in the collection, where the element is used as the key and the count is used as the value.
  • join Converts a collection to a string using a separator
  • toMap Converts a list of entries or separate lists of keys and values to a Map
  • asIterator Converts an enumeration to an iterator
  • asIterable Converts an iterator to an iterable
  • getFirst Gets the first element from a list
  • getElementType Gets the element type