Не понимаю что тут может быть не так?
public AmigoSet(Collection<? extends E> collection) {
int capacity = Math.max(16, (int) Math.ceil(collection.size() / .75f));
map = new HashMap<>(capacity);
for (E e : collection) {
map.put(e, PRESENT);
}
}
package com.javarush.task.task37.task3707;
import java.io.Serializable;
import java.util.*;
public class AmigoSet<E> extends AbstractSet<E> implements Serializable, Cloneable, Set<E> {
private static final Object PRESENT = new Object();
private transient HashMap<E, Object> map;
public AmigoSet() {
map = new HashMap<>();
}
public AmigoSet(Collection<? extends E> collection) {
int capacity = Math.max(16, (int) Math.ceil(collection.size() / .75f));
map = new HashMap<>(capacity);
for (E e : collection) {
this.add(e);
}
}
@Override
public boolean add(Object o) {
return null == map.put((E) o, PRESENT);
}
@Override
public Iterator iterator() {
return null;
}
@Override
public int size() {
return 0;
}
}