Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * Created on 08.12.2004
 * 
 * COPYRIGHT NOTICE
 * 
 * Copyright (C) 2005 DFKI GmbH, Germany
 * Developed by Benedikt Fries, Matthias Klusch
 * 
 * The code is free for non-commercial use only.
 * You can redistribute it and/or modify it under the terms
 * of the Mozilla Public License version 1.1  as
 * published by the Mozilla Foundation at
 * http://www.mozilla.org/MPL/MPL-1.1.txt
 */

import java.util.Iterator;

import java.util.Map;
import java.util.Set;

public class Main {
    public static void print(Set set) {
        Iterator iter = set.iterator();
        System.out.println("Printing Set: ");
        while (iter.hasNext()) {
            System.out.println("   " + iter.next());
        }
    }

    public static void print(Map map) {
        Iterator iter = map.entrySet().iterator();
        Map.Entry me;
        System.out.println("Printing Map: ");
        while (iter.hasNext()) {
            me = (Map.Entry) iter.next();
            System.out.println("   " + me.getKey() + " - " + me.getValue());
        }
    }
}