• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Curly Generics Question - Update
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Curly Generics Question - Update


  • Subject: Re: Curly Generics Question - Update
  • From: Henrique Prange <email@hidden>
  • Date: Fri, 15 May 2009 22:51:08 -0300

Hi Mike,

The following solution doesn't solve the unchecked type cast problem. But it respect PECS definition and accept a Map<String, NSArray<String>> as parameter. Do you think it is reasonable?

public <V extends List<String> > WORequest treateRequest(String method, String url, String anHTTPVersion, Map<String, ? super V> someHeaders, NSData content, Map<String, Object> someInfo) {
...
someHeaders.put("foo", (V) Collections.singletonList("bar"));
...
}


Cheers,

Henrique

On May 15, 2009, at 8:29 PM, Mike Schrag wrote:

Map< String, List< String >> correctHeaders = new HashMap< String, List< String > >();
btw, this is what i was saying that the only typesafe way to do this is to copy the original headers -- so you would do new HashMap<String, List<String>>(originalHeaders) and then you'd have a properly typesafe <String, List<String>> that you can happily insert into whatever List<String> subtypes you want inside of createRequest. But it takes a copy to do it, which kind of sucks.

ms

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Curly Generics Question - Update
      • From: Mike Schrag <email@hidden>
References: 
 >Curly Generics Question (From: Andrew Lindesay <email@hidden>)
 >Re: Curly Generics Question - Update (From: Andrew Lindesay <email@hidden>)
 >Re: Curly Generics Question - Update (From: Jim Kinsey <email@hidden>)
 >Re: Curly Generics Question - Update (From: Mike Schrag <email@hidden>)
 >Re: Curly Generics Question - Update (From: Lachlan Deck <email@hidden>)
 >Re: Curly Generics Question - Update (From: Mike Schrag <email@hidden>)

  • Prev by Date: Re: Curly Generics Question - Update
  • Next by Date: Re: Curly Generics Question - Update
  • Previous by thread: Re: Curly Generics Question - Update
  • Next by thread: Re: Curly Generics Question - Update
  • Index(es):
    • Date
    • Thread