Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332831 - save retrieval of size of an array []
Summary: save retrieval of size of an array []
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-17 04:58 EST by Stephan Leicht Vogt CLA
Modified: 2021-08-19 11:02 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Leicht Vogt CLA 2010-12-17 04:58:17 EST
As stated in the Forum-Message <http://www.eclipse.org/forums/index.php?t=msg&th=201998&start=0&S=be81068d90b5b6b0945dc5560a882115> it would be useful if there would be also an save way to get the size of an array like it allready exists for Strings.

Example:
int size = ListUtility.size(someByte[]); (someByte[] can be null)
Comment 1 Ivan Motsch CLA 2010-12-23 08:19:34 EST
This will be added for the June 2011 release either in ListUtility, CollectionUtility or ArrayUtility
Comment 2 Ivan Motsch CLA 2011-05-02 10:07:58 EDT
Done as ListUtility.length.

junit test:
    assertEquals(-1, ListUtility.length(null));
    assertEquals(3, ListUtility.length(new int[3]));
    assertEquals(3, ListUtility.length(new int[3][4]));
    assertEquals(3, ListUtility.length(new String[3]));
    assertEquals(3, ListUtility.length(new String[3][4]));
    assertEquals(3, ListUtility.length(new ArrayList<String>(Arrays.asList(new String[]{"a", "b", "c"}))));
    assertEquals(0, ListUtility.length(new HashMap<String, String>()));
Comment 3 Matthias Zimmermann CLA 2011-06-28 08:04:22 EDT
shipped with eclipse scout 3.7.0