public <E> String FUNCTIONNAME( ?,?)

  • Thread starter waiter.james1991
  • Start date
W

waiter.james1991

public <E> String FUNCTIONNAME( ?,?) {

......
}


it's return type is <E>String ???
what it's exactly mean?
 
J

Jeff Higgins

L

Lew

No.

Got enough question marks there?

See
http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4

"MethodHeader:
" MethodModifiers[opt] TypeParameters[opt] Result MethodDeclarator Throws[opt] "

http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.4

"A method is /generic/ if it declares one or more type variables (§4.4).
"These type variables are known as the type parameters of the method. The form of the type parameter section of a generic method is identical to the type parameter section of a generic class (§8.1.2)."

etc.
No. The return type would be String.
The <E>, a "type parameter", simply introduces a name
for a generic type into the scope of the method.
You have apparently chosen to ignore it in your paraphrased example.
what it's [sic] exactly mean?

See:
<http://docs.oracle.com/javase/tutorial/extra/generics/methods.html>
and/or a generic web search using the terms java+generic+method.
 
J

Jeff Higgins

No.

Got enough question marks there?

See
http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4

"MethodHeader:
" MethodModifiers[opt] TypeParameters[opt] Result MethodDeclarator Throws[opt]"

http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.4.4

"A method is /generic/ if it declares one or more type variables (§4.4).
"These type variables are known as the type parameters of the method. The form of the type parameter section of a generic method is identical to the type parameter section of a generic class (§8.1.2)."

etc.

It's curious that you reply to my reply to the original post
and then leave my comments uncommented upon. It seems somewhat
akin to top posting. I admit to having committed the same
on occasion, but you do it with some regularity and I thought
to comment on this occasion. Perhaps your newsreader makes it
difficult to negotiate the hierarchy of the thread and you
simply reply to the last post read.
No. The return type would be String.
The<E>, a "type parameter", simply introduces a name
for a generic type into the scope of the method.
You have apparently chosen to ignore it in your paraphrased example.
what it's [sic] exactly mean?

See:
<http://docs.oracle.com/javase/tutorial/extra/generics/methods.html>
and/or a generic web search using the terms java+generic+method.
 
E

Eric Sosman

public <E> String FUNCTIONNAME( ?,?) {

......
}


it's return type is <E>String ???
what it's exactly mean?

Perhaps I'm missing something (it happens), but I don't
think it means anything at all. That is, I cannot think of
a way to fill in the elided bits to arrive at compilable code.

Could you show the actual code in which you found this,
with enough surrounding context to give slow plodders like
me a running start?
 
A

Arne Vajhøj


Since the manuals index will not have a snippet like the
quoted code, then it will be reading from first page to
last page for those not knowing that the keyword is "generics".

Arne
 
L

Lew

Jeff said:
It's curious that you reply to my reply to the original post
and then leave my comments uncommented upon. It seems somewhat
akin to top posting. I admit to having committed the same
on occasion, but you do it with some regularity and I thought
to comment on this occasion. Perhaps your newsreader makes it
difficult to negotiate the hierarchy of the thread and you
simply reply to the last post read.

I insert my comments inline where I have further remarks, but I keep
yours where they were, as with other cited material, to establish context
and to endorse the content, as useful at least and, in your case, as correct.

If I put my remarks under yours, then it looks as though I'm reacting to that
remark, when my point is usually marginal to an earlier line by a different
poster.

If I remove your remarks, then I lose the context that I deem important to cite.

I often find myself responding to threads where the main question has already
been answered better than I could have, but I see dangling threads. For example,
this is hypothetical, say I see an idiom for a 'final' instance method in a concurrent
context, and I see that 'final' might server better. I'll comment on that, and leave
your remarks in place in order not to lose the real answer.

And I'm using a web interface to Usenet which is a pain in the ass. It breaks lines
arbitrarily and doubles the lines, so a quoted line is
this is a broken

line through the

f- friendly interface.

I have to demangle a lot to post. It's a testament to how important I think my
comments are that I am willing to go through all this effort to share them.

You're welcome.

(That was a joke, BTW.)

For various reasons unrelated to product quality it's inconvenient to use
Thunderbird lately. I find the discussions here very enlightening so I soldier on.
 
J

Jeff Higgins

I insert my comments inline where I have further remarks, but I keep
yours where they were, as with other cited material, to establish context
and to endorse the content, as useful at least and, in your case, as correct.

If I put my remarks under yours, then it looks as though I'm reacting to that
remark, when my point is usually marginal to an earlier line by a different
poster.

If I remove your remarks, then I lose the context that I deem important to cite.

I often find myself responding to threads where the main question has already
been answered better than I could have, but I see dangling threads. For example,
this is hypothetical, say I see an idiom for a 'final' instance method in a concurrent
context, and I see that 'final' might server better. I'll comment on that, and leave
your remarks in place in order not to lose the real answer.

Ah, OK an unannounced inline addendum. Thanks for the explanation.

While replying to the original post I briefly considered tracking down
and including links to the relevant parts of the JLS but thought that
would muddy my attempt at a simple lay explanation.
You gasp and sputter, I heard you.
Anyway you whip out the BNF in all its glorious Truth and Beauty, and it
is Majestic. I thank you. No joke. I'm sure the newb is feelin' it too.
And I'm using a web interface to Usenet which is a pain in the ass. It breaks lines
arbitrarily and doubles the lines, so a quoted line is


I have to demangle a lot to post. It's a testament to how important I think my
comments are that I am willing to go through all this effort to share them.

You're welcome.

(That was a joke, BTW.)

For various reasons unrelated to product quality it's inconvenient to use
Thunderbird lately. I find the discussions here very enlightening so I soldier on.

Yep, it's sad. I recall Andrew Thompson experiencing a similar
predicament (forced use of a WITUN) shortly before he pissed off
of c.l.j.p to focus his attention on the greater volume an perhaps
more stimulating Q/A type discussion at the (then) Sun Java Forums.
 
J

Jeff Higgins

Ah, OK an unannounced inline addendum. Thanks for the explanation.

While replying to the original post I briefly considered tracking down
and including links to the relevant parts of the JLS but thought that
would muddy my attempt at a simple lay explanation.
You gasp and sputter, I heard you.
Anyway you whip out the BNF in all its glorious Truth and Beauty, and it
is Majestic. I thank you. No joke. I'm sure the newb is feelin' it too.
If that sounds angry, it really is not.
Yep, it's sad. I recall Andrew Thompson experiencing a similar
predicament (forced use of a WITUN) shortly before he pissed off
of c.l.j.p to focus his attention on the greater volume an perhaps
more stimulating Q/A type discussion at the (then) Sun Java Forums.
Yes, I do miss his rambunctious nature and
wealth of sharable knowledge. Other parts no.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top