MCPcopy Index your code
hub / github.com/EdwardRaff/JSAT / add

Method add

JSAT/src/jsat/utils/SortedArrayList.java:35–54  ·  view source on GitHub ↗
(T e)

Source from the content-addressed store, hash-verified

33 }
34
35 @Override
36 public boolean add(T e)
37 {
38 if(isEmpty())
39 {
40 return super.add(e);
41 }
42 else
43 {
44 int ind = Collections.binarySearch(this, e);
45 if (ind < 0)
46 ind = -(ind + 1);//Now it is the point where it should be inserted
47
48 if (ind > size())
49 super.add(e);
50 else
51 super.add(ind, e);
52 return true;
53 }
54 }
55
56 @Override
57 public void add(int index, T element)

Callers 1

addAllMethod · 0.95

Calls 1

sizeMethod · 0.65

Tested by

no test coverage detected