Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void load()
- {
- Scanner scan1 = null;
- Scanner scan2 = null;
- ArrayList MD51 = new ArrayList();
- ArrayList MD52 = new ArrayList();
- try
- {
- scan1 = new Scanner(new FileReader(input1));
- scan2 = new Scanner(new FileReader(input2));
- }
- catch (FileNotFoundException ex)
- {
- ex.printStackTrace();
- }
- while (scan1.hasNextLine())
- {
- scan1.useDelimiter("\n");
- String text = scan1.nextLine();
- Scanner scanner = new Scanner(text);
- while (scanner.hasNext())
- {
- scanner.next();
- MD51.add(text);
- }
- }
- while (scan2.hasNextLine())
- {
- scan2.useDelimiter("\n");
- String text = scan2.nextLine();
- Scanner scanner = new Scanner(text);
- while (scanner.hasNext())
- {
- scanner.next();
- MD52.add(text);
- }
- }
- }
- public int findDoubles()
- {
- int MD51Count = 0;
- int MD52Count = 0;
- int count;
- Object current1 = MD51.get(MD51Count);
- Object current2 = MD52.get(MD52Count);
- while (current1 != null && current2 != null)
- {
- if (current1 == current2)
- {
- count++;
- MD51Count++;
- MD52Count++;
- }
- else
- {
- MD51Count++;
- MD52Count++;
- }
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement