Am i stupid or is this task bugged. i did everything that conditions said and still one condition doesnt validate!!!
package com.codegym.task.task37.task3707;
import java.io.Serializable;
import java.util.*;
import static java.lang.Math.*;
public class AmigoSet<E> extends AbstractSet implements Serializable, Cloneable , Set {
private static final Object PRESENT = new Object();
private transient HashMap<E,Object> map;
public AmigoSet() {
this.map = new HashMap<>();
}
public AmigoSet(Collection<? extends E> collection) {
this.map= new HashMap<>(max(16,(int) ceil(collection.size()/.75f)));
for (E o : collection) map.put(o, PRESENT);
}
@Override
public Iterator iterator() {
return null;
}
@Override
public boolean addAll(Collection c) {
return false;
}
@Override
public int size() {
return 0;
}
@Override
public boolean add(Object e){
if (map.containsKey(e)){
return false;
}else{
map.put((E)e,PRESENT);
return true;
}
}
}