Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. /**
  2.  * Created by cfree on 3/28/2017.
  3.  */
  4. import java.util.*;
  5. import java.lang.*;
  6. import java.util.Arrays;
  7. import java.io.File;
  8.  
  9. public class lab6{
  10.  
  11.     public static ArrayList<String> bubble(ArrayList<String> arrList){
  12.         for(int i=0; i<arrList.size() - 1; i++){
  13.             for(int j=0; j<arrList.size() - i - 1; j++){
  14.                 if (arrList.get(j+1).compareToIgnoreCase(arrList.get(j)) < 0){
  15.                     String temp = arrList.get(j);
  16.                     arrList.set(j) = arrList.get(j+1);
  17.                     arrList.set(j+1) = temp;
  18.                 }
  19.             }
  20.         }
  21.         return arrList;
  22.     }
  23.  
  24.     public static void main(String [] args) throws java.io.FileNotFoundException {
  25.  
  26.         Scanner in = new Scanner(System.in);
  27.         Scanner fin = new Scanner( new File("./src/names.txt"));
  28.         String name = new String();
  29.  
  30.         while(fin.hasNext()){
  31.             name = fin.nextLine();
  32.         }
  33.         fin.close();
  34.     }
  35. }
  36.  
  37. //TODO
  38. //change to arrayList since you don't know size
  39. //read in and from the file
  40. //sort array after you read in from file
  41. //allow for binary search to look for someone
  42. //figuere out parth of the file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement