Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   public <E> String FUNCTIONNAME( ?,?) (http://www.velocityreviews.com/forums/t953186-public-e-string-functionname.html)

waiter.james1991@gmail.com 10-09-2012 08:48 AM

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

......
}


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

Roedy Green 10-09-2012 09:03 AM

Re: public <E> String FUNCTIONNAME( ?,?)
 
On Tue, 9 Oct 2012 01:48:48 -0700 (PDT), waiter.james1991@gmail.com
wrote, quoted or indirectly quoted someone who said :

>public <E> String FUNCTIONNAME( ?,?) {
>
> ......
>}
>
>
>it's return type is <E>String ???


Method names are lower case

The return type is String. To understand what the <E> means see
http://mindprod.com/jgloss/generics.html
--
Roedy Green Canadian Mind Products http://mindprod.com
The iPhone 5 is a low end Rolex.



Jeff Higgins 10-09-2012 02:23 PM

Re: public <E> String FUNCTIONNAME( ?,?)
 
On 10/09/2012 04:48 AM, waiter.james1991@gmail.com wrote:
> public<E> String FUNCTIONNAME( ?,?) {
>
> ......
> }
>
>
> it's return type is<E>String ???

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 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.



Lew 10-09-2012 05:15 PM

Re: public <E> String FUNCTIONNAME( ?,?)
 
Jeff Higgins wrote:
> waiter.james1991@ wrote:
>> public<E> String FUNCTIONNAME( ?,?) {
>>
>> ......
>> }
>>

>
>> it's return type is<E>String ???


No.

Got enough question marks there?

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

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

http://docs.oracle.com/javase/specs/...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.


--
Lew

Jeff Higgins 10-09-2012 09:30 PM

Re: public <E> String FUNCTIONNAME( ?,?)
 
On 10/09/2012 01:15 PM, Lew wrote:
> Jeff Higgins wrote:
>> waiter.james1991@ wrote:
>>> public<E> String FUNCTIONNAME( ?,?) {
>>>
>>> ......
>>> }
>>>

>>
>>> it's return type is<E>String ???

>
> No.
>
> Got enough question marks there?
>
> See
> http://docs.oracle.com/javase/specs/...8.html#jls-8.4
>
> "MethodHeader:
> " MethodModifiers[opt] TypeParameters[opt] Result MethodDeclarator Throws[opt]"
>
> http://docs.oracle.com/javase/specs/...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.

>



Eric Sosman 10-09-2012 09:40 PM

Re: public <E> String FUNCTIONNAME( ?,?)
 
On 10/9/2012 4:48 AM, waiter.james1991@gmail.com wrote:
> 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?

--
Eric Sosman
esosman@comcast-dot-net.invalid

Daniele Futtorovic 10-09-2012 09:47 PM

Re: public <E> String FUNCTIONNAME( ?,?)
 
On 09/10/2012 10:48, waiter.james1991@gmail.com allegedly wrote:
> public <E> String FUNCTIONNAME( ?,?) {
>
> ......
> }
>
>
> it's return type is <E>String ???
> what it's exactly mean?


RTFM.

--
DF.

Arne Vajhøj 10-09-2012 10:09 PM

Re: public <E> String FUNCTIONNAME( ?,?)
 
On 10/9/2012 5:47 PM, Daniele Futtorovic wrote:
> On 09/10/2012 10:48, waiter.james1991@gmail.com allegedly wrote:
>> public <E> String FUNCTIONNAME( ?,?) {
>>
>> ......
>> }
>>
>>
>> it's return type is <E>String ???
>> what it's exactly mean?

>
> RTFM.


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



Daniele Futtorovic 10-09-2012 10:43 PM

Re: public <E> String FUNCTIONNAME( ?,?)
 
On 10/10/2012 00:09, Arne Vajhøj allegedly wrote:
> On 10/9/2012 5:47 PM, Daniele Futtorovic wrote:
>> On 09/10/2012 10:48, waiter.james1991@gmail.com allegedly wrote:
>>> public <E> String FUNCTIONNAME( ?,?) {
>>>
>>> ......
>>> }
>>>
>>>
>>> it's return type is <E>String ???
>>> what it's exactly mean?

>>
>> RTFM.

>
> 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".


It's a fair cop.

<http://docs.oracle.com/javase/tutorial/java/generics/methods.html>

--
DF.

Lew 10-09-2012 11:08 PM

Re: public <E> String FUNCTIONNAME( ?,?)
 
Jeff Higgins wrote:
> 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.

--
Lew


All times are GMT. The time now is 12:17 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.