The Artima Developer Community
Sponsored Link

Java Buzz Forum
Is it bad if I use pointers in Java?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Brian McCallister

Posts: 1282
Nickname: frums
Registered: Sep, 2003

Brian McCallister is JustaProgrammer who thinks too much.
Is it bad if I use pointers in Java? Posted: Jan 11, 2004 3:16 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Brian McCallister.
Original Post: Is it bad if I use pointers in Java?
Feed Title: Waste of Time
Feed URL: http://kasparov.skife.org/blog/index.rss
Feed Description: A simple waste of time and weblog experiment
Latest Java Buzz Posts
Latest Java Buzz Posts by Brian McCallister
Latest Posts From Waste of Time

Advertisement

I frequently find myself writing code like:


    final boolean[] val = new boolean[] { false };
    mixed.forEach(new Closure()
    {
        public void execute(Object o)
        {
            val[0] = true;
        }
    });

in my unit tests for quick checks in order to get around the lack of explicit pointers in Java so that I can toggle a boolean in an anonymous inner class.

This feels like an awful hack, but does anyone know a better idiom?

Read: Is it bad if I use pointers in Java?

Topic: J2SE 1.5 Early Access Previous Topic   Next Topic Topic: Desktop Client Battles

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use