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


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

Re: Eclipse doesn't like else

Newsgroups comp.lang.java.programmer
Date 2017-05-12 13:33 -0700
References <3c792901-a05d-4a02-b058-20b9e0576095@googlegroups.com> <of4u4o$n75$2@Gaia.teknon.de>
Message-ID <aa56754a-0845-4fce-b069-c4fe63067ee7@googlegroups.com> (permalink)
Subject Re: Eclipse doesn't like else
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


On Friday, May 12, 2017 at 3:05:57 PM UTC-4, Volker Borchert wrote:
> What about
>     myPrep = conn.prepareStatement(someCondition.equals("one")
>                                    ? "query something"
>                                    : "query something else");
> 
> 

Yes, that is also acceptable.  That is a very similar result to the
String qry;
if (someCondition.equals("one")) {
qry = "something";
} else {
qry = "something else";
}
myPrep = conn.prepareStatement(qry);

except that I also translate some of this code into another hybrid language which integrates with Java and accepts calls to Java methods but has it's own syntax for conditions which doesn't accept the ? condition.  Otherwise it's possible to consider this the cleanest version.

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


Thread

Eclipse doesn't like else Eric Douglas <e.d.programmer@gmail.com> - 2017-05-12 10:44 -0700
  Re: Eclipse doesn't like else Marcel Mueller <news.5.maazl@spamgourmet.org> - 2017-05-12 20:30 +0200
    Re: Eclipse doesn't like else Eric Douglas <e.d.programmer@gmail.com> - 2017-05-12 11:53 -0700
      Re: Eclipse doesn't like else Arne Vajhøj <arne@vajhoej.dk> - 2017-05-13 20:39 -0400
        Re: Eclipse doesn't like else v_borchert@despammed.com (Volker Borchert) - 2017-05-14 03:50 +0000
  Re: Eclipse doesn't like else v_borchert@despammed.com (Volker Borchert) - 2017-05-12 18:15 +0000
    Re: Eclipse doesn't like else Eric Douglas <e.d.programmer@gmail.com> - 2017-05-12 13:33 -0700
  Re: Eclipse doesn't like else Martin Gregorie <martin@address-in-sig.invalid> - 2017-05-12 21:22 +0000
  Re: Eclipse doesn't like else v_borchert@despammed.com (Volker Borchert) - 2017-05-13 00:52 +0000
  Re: Eclipse doesn't like else Arne Vajhøj <arne@vajhoej.dk> - 2017-05-13 21:04 -0400

csiph-web