Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
hey mom its 420
May 12, 2007

The other day I was thinking, is there any reason why Java doesn't have return type polymoprhism? I mean like having public String foo() and public int foo() and then the one that gets called depends on what kind of type of return value the caller expects. This works really nicely in languages like Haskell and I see nothing in Java that prevents it form having this feature.

Adbot
ADBOT LOVES YOU

hey mom its 420
May 12, 2007

I'm using SAX2 to get some XML over a socket and parse it.
I first make a socket and then pass the InputStream from that socket and my DefaultHandler to the parse method.
What I'd like to do is to finish parsing once the root XML element has been closed and leave the socket open so I can write something back to it. What's the best way to do this?
Basically the parse method never yields control. If I force it to yield control by throwing an exception from, say, my overriden endElement method in my handler, it closes the socket connection, which I don't want it to do.

hey mom its 420
May 12, 2007

Thanks, I passed the output stream to the event handler for the last element and replied from there.

hey mom its 420
May 12, 2007

Capc posted:

What's the next logical step? What are some subjects that might be helpful or fun to learn?
Try a different language or two. Not a jab against Java, it's just good to know several languages, especially if they differ in paradigms. I'd suggest picking up Python, for instance.

Otherwise, I'd suggest solving Project Euler problems or just learning about data structures like balanced binary trees, B-trees, tries, hash maps, implementing these is loads of fun.

EDIT: Gah, I thought this was the general programming thread. The original point still applies though.

hey mom its 420 fucked around with this message at 13:27 on Jun 19, 2009

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply