Hacker News new | past | comments | ask | show | jobs | submit login

For debugging via print statements:

    public int echo(int x, String name)
    {
        System.out.println(name + ":\t" + x);
        return x;
    }
(I also have versions with only x as an argument, and with the other types).

In use:

    this.setPreferredSize(new Dimension(getPreferredSize.getWidth(), echo(getViewportHeight(itemCount), "Viewport"));
In addition to sparing me from System.out.println verbosity, it's really useful in situations like the above where the value you want to print isn't bound to a variable.



Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: