Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by cfree on 3/28/2017.
- */
- import java.util.*;
- import java.lang.*;
- import java.util.Arrays;
- import java.io.File;
- public class lab6{
- public static ArrayList<String> bubble(ArrayList<String> arrList){
- for(int i=0; i<arrList.size() - 1; i++){
- for(int j=0; j<arrList.size() - i - 1; j++){
- if (arrList.get(j+1).compareToIgnoreCase(arrList.get(j)) < 0){
- String temp = arrList.get(j);
- arrList.set(j) = arrList.get(j+1);
- arrList.set(j+1) = temp;
- }
- }
- }
- return arrList;
- }
- public static void main(String [] args) throws java.io.FileNotFoundException {
- Scanner in = new Scanner(System.in);
- Scanner fin = new Scanner( new File("./src/names.txt"));
- String name = new String();
- while(fin.hasNext()){
- name = fin.nextLine();
- }
- fin.close();
- }
- }
- //TODO
- //change to arrayList since you don't know size
- //read in and from the file
- //sort array after you read in from file
- //allow for binary search to look for someone
- //figuere out parth of the file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement