As an easy and clean way of using an Enumeration with the enhanced for loop, convert to an ArrayList with java.util.Collections.list.
for (TableColumn col : Collections.list(columnModel.getColumns()) {
(javax.swing.table.TableColumnModel.getColumns returns Enumeration.)
Note, this may be very slightly less efficient.
Related Contents:
- Convert Iterable to Stream using Java 8 JDK
- Easy way to convert Iterable to Collection
- Java: Get first item from a collection
- Why does Stream not implement Iterable?
- Why does Iterable not provide stream() and parallelStream() methods?
- What is the difference between iterator and iterable and how to use them?
- Why is Java’s Iterator not an Iterable?
- Convert Java Array to Iterable
- Difference between Java Enumeration and Iterator
- Java Enum Methods – return opposite direction enum
- Get size of an Iterable in Java
- Iterate enum values using java generics
- Why does Java not allow foreach on iterators (only on iterables)? [duplicate]
- Iterate an Enumeration in Java 8
- iterating through Enumeration of hastable keys throws NoSuchElementException error
- Java getting the Enum name given the Enum Value
- What are the differences between a Java enum and a class with private constructor? [duplicate]
- Collection to Iterable
- Why doesn’t the String class in Java implement Iterable?
- Java: Enumeration from Set
- Why should Java 8’s Optional not be used in arguments
- PreparedStatement IN clause alternatives?
- How to get a file’s Media Type (MIME type)?
- Map enum in JPA with fixed values?
- Do spurious wakeups in Java actually happen?
- Generate UML Class Diagram from Java Project [closed]
- When is a Java method name too long? [closed]
- Lambda expression vs method reference
- Copy a stream to avoid “stream has already been operated upon or closed”
- Can you avoid Gson converting “” into unicode escape sequences?
- Replacing a fragment with another fragment inside activity group
- If using maven, usually you put log4j.properties under java or resources?
- Modify request parameter with servlet filter
- How to properly override clone method?
- ArrayIndexOutOfBoundsException when using the ArrayList’s iterator [duplicate]
- Found shared references to a collection org.hibernate.HibernateException
- what is the sense of final ArrayList?
- When using == for a primitive and a boxed value, is autoboxing done, or is unboxing done
- How to read the full stacktrace in Java where it says e.g. “… 23 more”
- Parsing JSON in Java without knowing JSON format
- Find if a number is a power of two without math function or log function
- multiple dex files define landroid/support/annotation/AnimRes
- What is the main difference between Collection and Collections in Java? [closed]
- Formatting date in Thymeleaf
- Automatic cookie handling with OkHttp 3
- Get value of day month from Date object in Android?
- How to change spaces to underscore and make string case insensitive?
- Java Arrays & Generics : Java Equivalent to C# IEnumerable
- Programming Java 7 in Eclipse
- Create threads in java to run in background