MCPcopy Create free account
hub / github.com/Freeze777/SDE-Interviewer-Notes / Push

Method Push

CleanCode/src/test/java/FoodPandaTest.java:19–25  ·  view source on GitHub ↗
(T t)

Source from the content-addressed store, hash-verified

17class MySet<T> implements ISet<T> {
18 private final ArrayList<T> store = new ArrayList<>();
19 @Override
20 public void Push(T t) throws IllegalArgumentException {
21 if (t == null)
22 throw new IllegalArgumentException();
23 if (store.stream().noneMatch(e -> e.equals(t)))
24 store.add(t);
25 }
26
27 @Override
28 public T Pop() throws NoSuchElementException {

Callers 3

Calls 2

equalsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected