Created
June 23, 2012 09:22
-
-
Save alisaifee/2977681 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
class Reduce | |
{ | |
public static void main( String [] args){ | |
try{ | |
String ref = args[0]; | |
String data = args[1]; | |
FileInputStream fref = new FileInputStream(ref); | |
FileInputStream fdata = new FileInputStream(data); | |
Set<String> refs = new HashSet<String>(); | |
DataInputStream in = new DataInputStream(fref); | |
BufferedReader br = new BufferedReader(new InputStreamReader(in)); | |
String line; | |
while ( ( line = br.readLine () ) != null ){ | |
refs.add( line ); | |
} | |
in = new DataInputStream(fdata); | |
br = new BufferedReader(new InputStreamReader(in)); | |
while ( ( line = br.readLine () ) != null ){ | |
String [] tokens = line.split(","); | |
if ( !refs.contains ( tokens [0] ) ){ | |
System.out.println(line); | |
} | |
} | |
}catch (Exception e){ | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment