-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchValue.java
38 lines (33 loc) · 1.08 KB
/
SearchValue.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package database;
import java.util.Scanner;
/**
* class search values.
* */
public class SearchValue {
/**
* searching values.
* */
public static void searchValue() {
Scanner input = new Scanner(System.in);
boolean found = false;
if (!CreateData.getValues().isEmpty()) {
System.out.println("Give me the value you want to find:");
String value = input.next();
for (int i = 0; i < CreateData.getValues().size(); i++) {
for (int j = 0; j < CreateData.getValues().get(i).size(); j++) {
if ((CreateData.getValues().get(i).get(j)).equals(value)) {
found = true;
System.out.println("ID:" + i + " and values are: "
+ CreateData.getValues().get(i));
System.out.println();
}
}
}
if(found == false){
System.out.println("Couldn't found "+ value);
}
}
System.out.println();
Database.menu();
}
}