alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 * ClassOne.java
 *
 * Created on 23 February 2004, 15:49
 */

package org.netbeans.test.rollback;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;


/**
 *
 * @author  Dan
 */
public class ClassThree {
    
    public static long numero;

    public List list;
    public Set set;
    
    static {
        numero = 123;
    }
    
    public ClassThree () {
        list = new ArrayList();
        set = new HashSet();
    }
    
    public void addToList(Object obj) {
        list.add(obj);
        System.out.println(obj + " added");
    }
    
    public void addToSet(Object obj) {
        set.add(obj);
        System.out.println(obj + " added");
    }
    
    public void printItems() {
        System.out.println("--------------");
        for (Iterator iter = list.iterator(); iter.hasNext();) {
            System.out.println(iter.next());
        }
        for (Iterator iter = set.iterator(); iter.hasNext();) {
            System.out.println(iter.next());
        }
    }
    
}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.