Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #33922
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Robert Klemme <shortcutter@googlemail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Libraries for sysadmins? |
| Date | Fri, 4 Mar 2016 18:06:40 +0100 |
| Lines | 51 |
| Message-ID | <djttl0Fct5hU1@mid.individual.net> (permalink) |
| References | <2cec6af2-9636-4a2a-8849-b01286c0814c@googlegroups.com> <sysadmins-20160304161143@ram.dialup.fu-berlin.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net kDGr85eoStMJMCTKmvvA7gIW+FlzfbguCbh7PkIXly8s7T66Q= |
| Cancel-Lock | sha1:ikqPRjEn/LAM0oqxCamHFrM3pwg= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 |
| In-Reply-To | <sysadmins-20160304161143@ram.dialup.fu-berlin.de> |
| Xref | csiph.com comp.lang.java.programmer:33922 |
Show key headers only | View raw
I would look into using JRuby, maybe also look into Groovy (not sure how
much alive the latter is these days).
On 04.03.2016 16:13, Stefan Ram wrote:
> Elena <egarrulo@gmail.com> writes:
>> processing text files line by line
>
> Writing lines to a text file:
>
> new java.io.FileWriter( "c:\\example.txt" ).
> append( "alpha\n" ).close();
In (J)Ruby:
File.open("example.txt", "a") {|io| io.puts "alpha"}
> Reading a text file line by line (not tested):
>
> final java.util.Scanner scanner
> = new java.util.Scanner( new java.io.File( "file.txt" ));
> while( scanner.hasNextLine() )
> { final java.lang.String line = scanner.nextLine();
In (J)Ruby:
File.foreach "file.txt" do |line|
# whatever
end
>> filtering collections
>
> (not tested):
>
> java.util.Arrays.asList( 1, 2, 3 ).stream().
> filter( x -> "x >= 2 )
Again, in (J)Ruby:
[1,2,3].select {|x| x >= 2}
(Not exactly the same, but can easily be made to if need be.)
Kind regards
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Libraries for sysadmins? Elena <egarrulo@gmail.com> - 2016-03-04 03:33 -0800
Re: Libraries for sysadmins? Martin Gregorie <martin@address-in-sig.invalid> - 2016-03-04 11:44 +0000
Re: Libraries for sysadmins? egarrulo <egarrulo@gmail.com> - 2016-03-04 12:56 +0100
Re: Libraries for sysadmins? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-04 07:43 -0500
Re: Libraries for sysadmins? Robert Klemme <shortcutter@googlemail.com> - 2016-03-04 18:06 +0100
Re: Libraries for sysadmins? egarrulo <egarrulo@gmail.com> - 2016-03-04 20:30 +0100
Random permutations [was Re: Libraries for sysadmins?] Sebastian <news@seyweiler.dyndns.org> - 2016-03-05 00:56 +0100
Re: Random permutations [was Re: Libraries for sysadmins?] Robert Klemme <shortcutter@googlemail.com> - 2016-03-05 12:11 +0100
Re: Random permutations [was Re: Libraries for sysadmins?] Sebastian <news@seyweiler.dyndns.org> - 2016-03-05 16:41 +0100
Re: Random permutations [was Re: Libraries for sysadmins?] Brixomatic <brixomatic@yahoo.com> - 2016-03-05 19:20 +0100
Re: Random permutations [was Re: Libraries for sysadmins?] Andreas Leitgeb <avl@logic.at> - 2016-03-05 18:46 +0000
Re: Random permutations [was Re: Libraries for sysadmins?] Brixomatic <brixomatic@yahoo.com> - 2016-03-15 19:22 +0100
Re: Random permutations [was Re: Libraries for sysadmins?] Andreas Leitgeb <avl@logic.at> - 2016-03-15 22:30 +0000
Re: Random permutations [was Re: Libraries for sysadmins?] Andreas Leitgeb <avl@logic.at> - 2016-03-05 18:30 +0000
Re: Random permutations [was Re: Libraries for sysadmins?] Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-05 13:46 -0500
Re: Random permutations [was Re: Libraries for sysadmins?] Andreas Leitgeb <avl@logic.at> - 2016-03-05 19:40 +0000
Re: Libraries for sysadmins? Robert Klemme <shortcutter@googlemail.com> - 2016-03-05 12:10 +0100
Re: Libraries for sysadmins? Arne Vajhøj <arne@vajhoej.dk> - 2016-03-04 21:42 -0500
Re: Libraries for sysadmins? Arne Vajhøj <arne@vajhoej.dk> - 2016-03-04 21:48 -0500
csiph-web