Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #35358

Re: XML

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: XML
Date 2016-08-16 15:57 -0400
Organization A noiseless patient Spider
Message-ID <novr71$8j0$1@dont-email.me> (permalink)
References (10 earlier) <de36e9b4-44de-44ba-835d-80e9dc80fa90@googlegroups.com> <nofttr$u80$1@dont-email.me> <00fae8a8-dc01-435f-9f33-e5a5055d93df@googlegroups.com> <nonsuv$425$1@gioia.aioe.org> <9c174795-1c98-46f0-bbac-179581cd39a2@googlegroups.com>

Show all headers | View raw


On 8/16/2016 2:49 PM, Eric Douglas wrote:
> On Saturday, August 13, 2016 at 3:38:21 PM UTC-4, Arne Vajhøj wrote:
>> Searching for various data is easy using the new Java 8 streams:
>>
>> 		// search
>> 		Data o1 = data2.getList().stream().filter(item -> item.getIv() ==
>> 456).findFirst().get();
>> 		Data o2 = data2.getList().stream().filter(item -> item instanceof
>> DataA && ((DataA)item).getSv().equals("ABC")).findFirst().get();
>>
>
> I haven't used this stream feature yet.  Is that doing the same thing this guy is doing?
> http://blog.bdoughan.com/2012/08/handle-middle-of-xml-document-with-jaxb.html

     No: The "streams" Arne mentions are not the "XMLStreams" and
"StreamSources" found at your link.  See

http://docs.oracle.com/javase/tutorial/collections/streams/index.html

     (Note also that Arne's example is slightly abbreviated, or perhaps
slightly optimistic: The findFirst() operation produces an Optional
that will be empty if nothing satisfies the filter() predicate, and
performing get() on an empty Optional throws NoSuchElementException.
"Serious" code would have to be cognizant of the possibility.)

-- 
esosman@comcast-dot-net.invalid
The Tooth Fairy's gone high-tech, pays in Bitecoin.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

XML Eric Douglas <e.d.programmer@gmail.com> - 2016-07-29 13:25 -0700
  Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-07-29 19:46 -0400
  Re: XML Roedy Green <inquiry@mindprod.com> - 2016-07-30 17:09 -0700
    Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-07-30 21:49 -0400
      Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-07-30 22:35 -0400
      Re: XML Roedy Green <inquiry@mindprod.com> - 2016-07-31 21:39 -0700
        Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-01 05:19 -0700
          Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-01 08:51 -0400
            Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-05 06:07 -0700
              Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-05 10:17 -0700
              Re: XML Stanimir Stamenkov <s7an10@netscape.net> - 2016-08-07 19:04 +0300
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-08 05:38 -0700
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-08 07:19 -0700
                Re: XML Stanimir Stamenkov <s7an10@netscape.net> - 2016-08-09 23:57 +0300
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-10 05:37 -0700
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-10 10:39 -0700
                Re: XML Stanimir Stamenkov <s7an10@netscape.net> - 2016-08-10 22:05 +0300
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-10 13:29 -0700
                Re: XML Stanimir Stamenkov <s7an10@netscape.net> - 2016-08-11 02:18 +0300
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-11 05:15 -0700
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-11 05:50 -0700
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-11 12:24 -0700
                Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-13 15:38 -0400
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-16 11:49 -0700
                Re: XML Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-16 15:57 -0400
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-16 13:20 -0700
                Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 17:04 -0400
                Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 21:37 -0400
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-17 05:22 -0700
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-17 05:21 -0700
                Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 16:13 -0400
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-16 13:22 -0700
                Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 16:53 -0400
                Re: XML Eric Douglas <e.d.programmer@gmail.com> - 2016-08-16 13:32 -0700
                Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-16 16:47 -0400
                Re: XML Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-08-16 16:59 -0400
        Re: XML Arne Vajhøj <arne@vajhoej.dk> - 2016-08-01 08:46 -0400

csiph-web