Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39026 > unrolled thread
| Started by | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| First post | 2019-07-30 15:14 +0200 |
| Last post | 2019-07-30 17:32 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.java.programmer
Calling the other overloaded method Cecil Westerhof <Cecil@decebal.nl> - 2019-07-30 15:14 +0200
Re: Calling the other overloaded method "Jeffrey H. Coffield" <jeffrey@digitalsynergyinc.com> - 2019-07-30 06:47 -0700
Re: Calling the other overloaded method Lars Enderin <lars.enderin@telia.com> - 2019-07-30 17:32 +0200
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2019-07-30 15:14 +0200 |
| Subject | Calling the other overloaded method |
| Message-ID | <878ssfoeav.fsf@munus.decebal.nl> |
I do not think it is important, but better save as sorry: I am doing
this in jshell.
When I have the following code:
Long[] getFibonacciArray() {
return null; // getFibonacciArray(0);
}
Long[] getFibonacciArray(int from) {
return getFibonacciStream().skip(from).toArray(Long[]::new);
}
It compiles without problem. But I want the first method to be:
Long[] getFibonacciArray() {
return getFibonacciArray(0);
}
But when using this, I get:
| Error:
| method getFibonacciArray in class cannot be applied to given types;
| required: no arguments
| found: int
| reason: actual and formal argument lists differ in length
| return getFibonacciArray(0);
| ^---------------^
What am I doing wrong?
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [next] | [standalone]
| From | "Jeffrey H. Coffield" <jeffrey@digitalsynergyinc.com> |
|---|---|
| Date | 2019-07-30 06:47 -0700 |
| Message-ID | <qhphqg$9m0$1@dont-email.me> |
| In reply to | #39026 |
On 07/30/2019 06:14 AM, Cecil Westerhof wrote:
> I do not think it is important, but better save as sorry: I am doing
> this in jshell.
>
>
> When I have the following code:
> Long[] getFibonacciArray() {
> return null; // getFibonacciArray(0);
> }
>
> Long[] getFibonacciArray(int from) {
> return getFibonacciStream().skip(from).toArray(Long[]::new);
> }
>
> It compiles without problem. But I want the first method to be:
> Long[] getFibonacciArray() {
> return getFibonacciArray(0);
> }
>
> But when using this, I get:
> | Error:
> | method getFibonacciArray in class cannot be applied to given types;
> | required: no arguments
> | found: int
> | reason: actual and formal argument lists differ in length
> | return getFibonacciArray(0);
> | ^---------------^
>
> What am I doing wrong?
>
I can't replicate the problem on my system, but your code isn't a
complete example as it doesn't define getFibonacciStream.
Jeff Coffield
www.digtalsynergyinc.com
[toc] | [prev] | [next] | [standalone]
| From | Lars Enderin <lars.enderin@telia.com> |
|---|---|
| Date | 2019-07-30 17:32 +0200 |
| Message-ID | <bd26105c-d0ef-9970-aaf0-461161961e62@telia.com> |
| In reply to | #39026 |
2019-07-30 15:14 skrev Cecil Westerhof: > I do not think it is important, but better save as sorry: I am doing > this in jshell. The idiom is "better safe than sorry". Your version is unintelligible. HTH. -- Lars Enderin
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web