<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>One brike at a time &#187; Something for the week end</title>
	<atom:link href="http://digitalbrikes.com/onebrikeatatime/category/something-for-the-week-end/feed/" rel="self" type="application/rss+xml" />
	<link>http://digitalbrikes.com/onebrikeatatime</link>
	<description>Notes on software development</description>
	<lastBuildDate>Fri, 18 Mar 2011 14:03:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Integer flyweight implementation</title>
		<link>http://digitalbrikes.com/onebrikeatatime/2010/04/23/integer-flyweight-implementation/</link>
		<comments>http://digitalbrikes.com/onebrikeatatime/2010/04/23/integer-flyweight-implementation/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 13:00:58 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Something for the week end]]></category>

		<guid isPermaLink="false">http://digitalbrikes.com/onebrikeatatime/?p=176</guid>
		<description><![CDATA[Here is a unit test that illustrates the Fly Weight implementation of Integers in Java. import junit.framework.TestCase; public final class TestIntegers extends TestCase { public void testValueOfGivesTheSameIntegerForSmallValues() { assertSame(Integer.valueOf(1), Integer.valueOf(1)); } public void testValueOfGivesADifferentIntegerForSomeValues() { assertNotSame(Integer.valueOf(13333333), Integer.valueOf(13333333)); assertEquals(Integer.valueOf(13333333), Integer.valueOf(13333333)); } public void testNew() { assertNotSame(new Integer(1), new Integer(1)); assertEquals(new Integer(1), new Integer(1)); } public void [...]]]></description>
			<content:encoded><![CDATA[<!-- no icon for 'Something for the week end' --><p>Here is a unit test that illustrates the <a href="http://web.cs.wpi.edu/~gpollice/cs509-s04/Patterns/Flyweight.htm">Fly Weight</a> implementation of Integers in Java.</p>
<pre>import junit.framework.TestCase;

public final class TestIntegers extends TestCase {
    public void testValueOfGivesTheSameIntegerForSmallValues() {
        assertSame(Integer.valueOf(1), Integer.valueOf(1));
    }

    public void testValueOfGivesADifferentIntegerForSomeValues() {
        assertNotSame(Integer.valueOf(13333333), Integer.valueOf(13333333));
        assertEquals(Integer.valueOf(13333333), Integer.valueOf(13333333));
    }

    public void testNew() {
        assertNotSame(new Integer(1), new Integer(1));
        assertEquals(new Integer(1), new Integer(1));
    }

    public void testValueOfGivesTheSameIntegerForAutoBoxing() {
        assertSame((Integer) 1, (Integer) 1);
    }

    public void testValueOfGivesADifferentIntegerForAutoBoxing() {
        assertNotSame((Integer) 13333333, (Integer) 13333333);
        assertEquals((Integer) 13333333, (Integer) 13333333);
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://digitalbrikes.com/onebrikeatatime/2010/04/23/integer-flyweight-implementation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Java BigDecimal equality</title>
		<link>http://digitalbrikes.com/onebrikeatatime/2010/03/06/java-bigdecimal-equality/</link>
		<comments>http://digitalbrikes.com/onebrikeatatime/2010/03/06/java-bigdecimal-equality/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 01:00:26 +0000</pubDate>
		<dc:creator>Denis</dc:creator>
				<category><![CDATA[Something for the week end]]></category>

		<guid isPermaLink="false">http://digitalbrikes.com/onebrikeatatime/?p=173</guid>
		<description><![CDATA[Here is why you should use compareTo to find out whether two BigDecimals represent the same number or not. import java.math.BigDecimal; import junit.framework.TestCase; public final class TestBigDecimal extends TestCase { public void testBigDecimalZeroEqualsBigDecimalValueOfZero() { assertTrue(BigDecimal.ZERO.equals(BigDecimal.valueOf(0))); } public void testBigDecimalZeroNotEqualsBigDecimalValueOfZeroDot() { assertFalse(BigDecimal.ZERO.equals(BigDecimal.valueOf(0.))); } public void testBigDecimalZeroEqualsBigDecimalValueOfZeroString() { assertTrue(BigDecimal.ZERO.equals(new BigDecimal("0"))); } public void testBigDecimalZeroEqualsBigDecimalValueOfZeroDotString() { assertTrue(BigDecimal.ZERO.equals(new BigDecimal("0."))); [...]]]></description>
			<content:encoded><![CDATA[<!-- no icon for 'Something for the week end' --><p>Here is why you should use compareTo to find out whether two BigDecimals represent the same number or not.</p>
<pre>import java.math.BigDecimal;

import junit.framework.TestCase;

public final class TestBigDecimal extends TestCase {
    public void testBigDecimalZeroEqualsBigDecimalValueOfZero() {
        assertTrue(BigDecimal.ZERO.equals(BigDecimal.valueOf(0)));
    }

    public void testBigDecimalZeroNotEqualsBigDecimalValueOfZeroDot() {
        assertFalse(BigDecimal.ZERO.equals(BigDecimal.valueOf(0.)));
    }

    public void testBigDecimalZeroEqualsBigDecimalValueOfZeroString() {
        assertTrue(BigDecimal.ZERO.equals(new BigDecimal("0")));
    }

    public void testBigDecimalZeroEqualsBigDecimalValueOfZeroDotString() {
        assertTrue(BigDecimal.ZERO.equals(new BigDecimal("0.")));
    }

    public void testBigDecimalZeroNotEqualsBigDecimalValueOfZeroDotZeroString() {
        assertFalse(BigDecimal.ZERO.equals(new BigDecimal("0.0")));
    }

    public void testBigDecimalZeroComparesToBigDecimalValueOfZeroDotAsZero() {
        assertEquals(0, BigDecimal.ZERO.compareTo(BigDecimal.valueOf(0.)));
    }

    public void testBigDecimalZeroComparesToBigDecimalValueOfZeroDotZeroStringAsZero() {
        assertEquals(0, BigDecimal.ZERO.compareTo(new BigDecimal("0.0")));
    }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://digitalbrikes.com/onebrikeatatime/2010/03/06/java-bigdecimal-equality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

