Skip to content

Commit 80b3981

Browse files
committed
Adding contains method
1 parent 72e75f5 commit 80b3981

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/main/java/CodingUtils/ArrayList8.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.
99
. The ArrayList8 Class was Coded by : Alexandre BOLOT
1010
.
11-
. Last Modified : 01/12/17 17:04
11+
. Last Modified : 02/12/17 13:16
1212
.
1313
. Contact : [email protected]
1414
...............................................................................................................................*/
@@ -46,6 +46,16 @@ public boolean addAllIf (Collection<? extends E> c, Predicate<? super E> filter)
4646
return true;
4747
}
4848

49+
public boolean contains (Predicate<? super E> filter)
50+
{
51+
for (E e : this)
52+
{
53+
if (filter.test(e)) return true;
54+
}
55+
56+
return false;
57+
}
58+
4959
public int countIf (Predicate<? super E> filter)
5060
{
5161
int count = 0;

src/test/java/CodingUtils/ArrayList8Test.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@
77
.
88
. The ArrayList8Test Class was Coded by : Alexandre BOLOT
99
.
10-
. Last Modified : 30/11/17 14:11
10+
. Last Modified : 02/12/17 13:16
1111
.
1212
. Contact : [email protected]
1313
...............................................................................................................................*/
1414

1515
public class ArrayList8Test
1616
{
17+
@Test
18+
public void contains () throws Exception
19+
{
20+
}
21+
1722
@Test
1823
public void getRandom () throws Exception
1924
{

0 commit comments

Comments
 (0)