Basic functional style question
mohan.radhakrishnan at polarisFT.com
mohan.radhakrishnan at polarisFT.com
Tue Nov 26 22:27:48 PST 2013
Hi,
This is a question from a user. I am trying to jdk 8 to parse a file and
apply a regex on it.
public class GCLogParser {
private void readFile() throws IOException {
Stream<String> s = Files.lines(get(("D:\\GC
Analysis\\usage.txt")), UTF_8);
s.forEach( this::parse );
}
public static void parseDocument( Parseable parser,
String data){
parser.apply(data);
}
private void parse( String data ){
Scanner s = new Scanner( data );
s.findInLine("Current.*?[/|]");
System.out.println(s.match().group());
}
public static void main( String... argv ) throws IOException {
new GCLogParser().readFile();
}
@FunctionalInterface
public interface Parseable{
void apply( String s);
}
}
This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.
Visit us at http://www.polarisFT.com
More information about the lambda-dev
mailing list