Advertisement
Guest User

fichero a Hashset

a guest
Nov 14th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. package practica2;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.FileNotFoundException;
  5. import java.io.FileReader;
  6. import java.io.IOException;
  7.  
  8. import java.util.HashSet;
  9.  
  10. public class practica2 {
  11. String variables[];
  12. HashSet<String []> datos = new HashSet<String[]>();
  13. public static void main (String Args[]) {
  14.  
  15. }
  16.  
  17. public void leerfichero(String archivo) throws FileNotFoundException,IOException{
  18. String linea;
  19. String [] palabras;
  20. FileReader fichero= new FileReader(archivo);
  21. BufferedReader buffer= new BufferedReader(fichero);
  22. int cont=0;
  23. while(buffer.readLine()!=null) {
  24. linea=buffer.readLine();
  25. if(cont==0){
  26. variables= linea.split(",");
  27. }
  28. else {
  29. palabras=linea.split(",");
  30. datos.add(palabras);
  31. }
  32. cont++;
  33. }
  34.  
  35. buffer.close();
  36. }
  37.  
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement