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

net.razorvine.pickle.objects.SetConstructor Maven / Gradle / Ivy

package net.razorvine.pickle.objects;

import java.util.ArrayList;
import java.util.HashSet;

import net.razorvine.pickle.IObjectConstructor;

/**
 * This object constructor creates sets.
 * 
 * @author Irmen de Jong ([email protected])
 */
public class SetConstructor implements IObjectConstructor {

	public SetConstructor() {
	}

	public Object construct(Object[] args) {
		// create a HashSet, args=arraylist of stuff to put in it
		@SuppressWarnings("unchecked")
		ArrayList data = (ArrayList) args[0];
		return new HashSet(data);
	}
}