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


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

Re: Good pattern for realizing the out-param capability in Java?

Newsgroups comp.lang.java.programmer
Date 2016-09-14 12:54 -0700
References <ec81f584-4e19-4f0b-ba29-924ef4e1a570@googlegroups.com>
Message-ID <8959892d-cd75-4680-b836-260a971f3366@googlegroups.com> (permalink)
Subject Re: Good pattern for realizing the out-param capability in Java?
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


On Wednesday, September 14, 2016 at 12:17:37 PM UTC-4, sande...@yahoo.com wrote:
> I want to solicit the opinion of the Java experts about realizing the out-param capability in Java.  Suppose there is a method in a class where I would like to realize the following:
> 
> class MyClass {
>     int myMethod(int inIntParam, int outIntParam, double outDoubleParam) {
>         // Accepts inIntParam as input
>         // Updates outIntParam and outDoubleParam
>         // Returns an int
>         …
>     }
>     …
> }

Methods don't normally need to pass out more than one value, so when they do I either create a custom object or pass out an array.  What advantage would you get from creating a generic custom class to pass out 2 values?

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


Thread

Good pattern for realizing the out-param capability in Java? sandeep6699@yahoo.com - 2016-09-14 09:17 -0700
  Re: Good pattern for realizing the out-param capability in Java? Robert Klemme <shortcutter@googlemail.com> - 2016-09-14 18:43 +0200
  Re: Good pattern for realizing the out-param capability in Java? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-14 12:55 -0400
  Re: Good pattern for realizing the out-param capability in Java? j4n bur53 <janburse@fastmail.fm> - 2016-09-14 21:00 +0200
  Re: Good pattern for realizing the out-param capability in Java? Eric Douglas <e.d.programmer@gmail.com> - 2016-09-14 12:54 -0700
    Re: Good pattern for realizing the out-param capability in Java? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-09-14 17:25 -0400
      Re: Good pattern for realizing the out-param capability in Java? j4n bur53 <janburse@fastmail.fm> - 2016-09-14 23:45 +0200
  Re: Good pattern for realizing the out-param capability in Java? Lew <lewbloch@gmail.com> - 2016-09-14 16:29 -0700

csiph-web