You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Andrey Andreev (JIRA)" <ji...@apache.org> on 2007/11/28 08:14:43 UTC

[jira] Created: (COLLECTIONS-279) LRUMap: moveToMRU is not invoked for new entry

LRUMap: moveToMRU is not invoked for new entry
----------------------------------------------

                 Key: COLLECTIONS-279
                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-279
             Project: Commons Collections
          Issue Type: Bug
          Components: Map
    Affects Versions: 3.2
            Reporter: Andrey Andreev
            Priority: Blocker
             Fix For: 3.3



	@Test
	public void testFirst() {
		LRUMap map = new LRUMap();

		String key = "key1";
		String value = "value1";

		map.put(key, value);
		Assert.assertEquals(map.get(key), value);
		Assert.assertEquals(map.get(map.firstKey()), value);
		
		key = "key2";
		value = "value2";
		map.put(key, value);
		// here it fails
		Assert.assertEquals(map.get(map.firstKey()), value);
	}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COLLECTIONS-279) LRUMap: moveToMRU is not invoked for new entry

Posted by "Benjamin Riefenstahl (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COLLECTIONS-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12554728 ] 

Benjamin Riefenstahl commented on COLLECTIONS-279:
--------------------------------------------------

It seems to me that the implementations of
AbstractLinkedMap.firstKey and AbstractLinkedMap.lastKey are
switched.

AbstractLinkedMap.addEntry adds new entries at header.before, so
firstKey should look there for the last entry that was added, not
in header.after.

When I switch the implementations of firstKey and lastKey,
AjaxStateManager from the RichFaces project works (see
<http://jira.jboss.org/jira/browse/RF-1460>).

Of course I don't know if any users of firstKey/lastKey use them
according to the current implementation instead of by the docs.

> LRUMap: moveToMRU is not invoked for new entry
> ----------------------------------------------
>
>                 Key: COLLECTIONS-279
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-279
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>    Affects Versions: 3.2
>            Reporter: Andrey Andreev
>            Priority: Blocker
>             Fix For: 3.3
>
>
> 	@Test
> 	public void testFirst() {
> 		LRUMap map = new LRUMap();
> 		String key = "key1";
> 		String value = "value1";
> 		map.put(key, value);
> 		Assert.assertEquals(map.get(key), value);
> 		Assert.assertEquals(map.get(map.firstKey()), value);
> 		
> 		key = "key2";
> 		value = "value2";
> 		map.put(key, value);
> 		// here it fails
> 		Assert.assertEquals(map.get(map.firstKey()), value);
> 	}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (COLLECTIONS-279) LRUMap: moveToMRU is not invoked for new entry

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COLLECTIONS-279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed COLLECTIONS-279.
-------------------------------------

    Resolution: Won't Fix

As Jifeng points out - we're going with the javadoc being in error rather than the implementation. 

getFirstKey returns the first one to be added etc.

> LRUMap: moveToMRU is not invoked for new entry
> ----------------------------------------------
>
>                 Key: COLLECTIONS-279
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-279
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>    Affects Versions: 3.2
>            Reporter: Andrey Andreev
>            Priority: Blocker
>             Fix For: 3.3
>
>         Attachments: AbstractLinkedMap.java.diff
>
>
> 	@Test
> 	public void testFirst() {
> 		LRUMap map = new LRUMap();
> 		String key = "key1";
> 		String value = "value1";
> 		map.put(key, value);
> 		Assert.assertEquals(map.get(key), value);
> 		Assert.assertEquals(map.get(map.firstKey()), value);
> 		
> 		key = "key2";
> 		value = "value2";
> 		map.put(key, value);
> 		// here it fails
> 		Assert.assertEquals(map.get(map.firstKey()), value);
> 	}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COLLECTIONS-279) LRUMap: moveToMRU is not invoked for new entry

Posted by "Benjamin Riefenstahl (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COLLECTIONS-279?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Riefenstahl updated COLLECTIONS-279:
---------------------------------------------

    Attachment: AbstractLinkedMap.java.diff

> LRUMap: moveToMRU is not invoked for new entry
> ----------------------------------------------
>
>                 Key: COLLECTIONS-279
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-279
>             Project: Commons Collections
>          Issue Type: Bug
>          Components: Map
>    Affects Versions: 3.2
>            Reporter: Andrey Andreev
>            Priority: Blocker
>             Fix For: 3.3
>
>         Attachments: AbstractLinkedMap.java.diff
>
>
> 	@Test
> 	public void testFirst() {
> 		LRUMap map = new LRUMap();
> 		String key = "key1";
> 		String value = "value1";
> 		map.put(key, value);
> 		Assert.assertEquals(map.get(key), value);
> 		Assert.assertEquals(map.get(map.firstKey()), value);
> 		
> 		key = "key2";
> 		value = "value2";
> 		map.put(key, value);
> 		// here it fails
> 		Assert.assertEquals(map.get(map.firstKey()), value);
> 	}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.