Thank you for the answer.

There are some advices in my project text:

-the structure of classes cant be modified

-the iterators can use support structures

-the iterators must throw ConcurrentModificationException and NoSuchElementException

-the method remove() is not implemented

-Cant use java API structures.

Implementation of a Set with and array of int with max dimension limited by the free memory.

This is the interface give to me by teacher

public interface Set extends Iterable, Cloneable{
/**
* Set Empty
*/
void clear();
/**
* is the set empty?
* @return true if the set is empty, else return false.
*/
boolean isEmpty();
/**
* @return the number of elements inside the Set
*/
int size();
/**
* @return max number of elements inside the set, -1 if the set is empty
*/
int max();
/**
* @param x
* @return
*/
int nextTrue(int x);
/**
* add an int in to the set
* @param x the int to add.
* @return true if the int isnt already inside the set, else return falsei
* @exception IllegalArgumentException if x<0
*/
boolean put(int x);
/**
*
* @return true if the int is already inside the set, else return false.
*/
boolean contains(int x);
/**
* remove an int from the set
* @param x
* @return true if the int is already inside the set, else return false
*/
boolean remove(int x);
/**
* Convert in String
* return a string with the elements of Set in ascending order in this form: [ 1 2 3 ]
*
* @return the string
*/
String toString();
/**
* Convert in array
* return an array of int with the elements of set in ascendig order
* @return array of int
*/
int [] toArray();
/**
* clone
* @return a clone of set
* @throws CloneNotSupportedException
*/
Object clone() throws CloneNotSupportedException;
/**
* return an iterator for iter. the elements in ascending order
* the method remove isnt implemented
* @return iterator
*/
Iterator iterator();
/**
* Union
* add the elements of y in my set
* @param y the second set
*/
void union (Insieme y);
/**
* Intersection
*
* @param y
*/
void intersection (Insieme y);
/**
* Difference
*
* @param y
*/
void difference(Insieme y);
}

import java.util.*;
public class HashSet implements Set {
final private int address(int x, int l){
int hash = (new Integer(x)).hashCode();
return (hash & 0x7FFFFFFF) % l;
public void difference(Set y){
throw new UnsupportedOperationException();
}
public void intersection(Set y){
throw new UnsupportedOperationException();
}
public int max(){
throw new UnsupportedOperationException();
}
public int nextTrue(int x){
throw new UnsupportedOperationException();
}
public boolean remove(int x){
throw new UnsupportedOperationException();
}
public Object clone(){
throw new UnsupportedOperationException();
}
}