All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jdesktop.swingx.util.Separator Maven / Gradle / Ivy

There is a newer version: 1.7.2
Show newest version
package org.jdesktop.swingx.util;

/**
 * A simple separator for adding in between each element in a list.
 * 

*

 * for (String s : strings) {
 *   stringBuilder.append(separator.get().append(s);
 * }
 * 
* * @param the type of separator * @author Karl Schaefer * @author Bruce Chapman (original idea) */ public class Separator { private T next; private final T separator; /** * Constructs a separator with the specified initial value and remaining separator. * * @param initial the value to use for the first call * @param separator the value to use after the first call */ public Separator(T initial, T separator) { this.next = initial; this.separator = separator; } /** * Returns the current value of the separator. * * @return the separator value */ public T get() { T result = next; next = separator; return result; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy