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

com.webapp.utils.collections.DataShowUtils Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version
package com.webapp.utils.collections;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public final class DataShowUtils {

	private DataShowUtils(){}

	public static  void viewList(List list) {
		for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}
	}

	public static  void viewSet(Set set) {
		Iterator iterator = set.iterator();
		for (; iterator.hasNext();) {
			System.out.println(iterator.next());
		}
	}

	public static  void viewMapKey(Map map) {
		Iterator iterator = map.keySet().iterator();
		for (; iterator.hasNext();) {
			System.out.println(iterator.next());
		}
	}

	public static  void viewMapVal(Map map) {
		Collection temp = map.values();
		for (Iterator i = temp.iterator(); i.hasNext();) {
			System.out.println(i.next());
		}
	}

	public static  void viewMapKeyVal(Map map) {
		Iterator> entry = map.entrySet().iterator();
		for (; entry.hasNext();) {
			Entry temp = entry.next();
			System.out.println(temp.getKey() + "-" + temp.getValue());
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy