Java Doc for ArrayUtil.java in  » Database-Client » SQLMinus » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » SQLMinus » util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   util.ArrayUtil

ArrayUtil
public class ArrayUtil (Code)
contains static methods that operate on arrays or return arrays.
author:
   Rahul Kumar June 2001.
author:
   $Author: rahul_kumar $ $Id: ArrayUtil.java,v 1.1 2004/01/01 06:49:54 rahul_kumar Exp rahul $




Method Summary
public static  String[]appendString(String[] sarr, String text)
    
public static  ObjectelementAt(Object a, int index)
     identical to get (for those used to ArrayList class methods).
public static  String[]enclose(String[] sarr, String before, String after)
     enclose each element in an array with given strings.
public static  Stringenclose(String sarr, String before, String after)
    
public static  Objectget(Object a, int index)
     returns the value at an index, a negative index denotes indexes taken from end backwards (-1 means last but one), An index higher than array size returns highest element, A negative index larger than size will return element at 0.
public static  intindexOf(Object a, Object key)
     sequential search of array returning index if found, else -1. Return values start from 0.
public static  intindexOf(int a, int key)
    
public static  intindexOfEndsWith(String a, String key)
     searches an array of Strings that ends with the given key returning its index. e.g.
public static  intindexOfEndsWith(String key, String a)
     checks whether the key, ends with a string in the array given. This is a reverse of the above, returning its index. e.g.
public static  intindexOfIndexOf(String a, String key)
     searches an array of Strings that includes the given key returning its index.
public static  intindexOfRegex(String s, String pattern)
     find a regex in the array and return its index, else -1.
public static  intindexOfStartsWith(String a, String key)
     searches an array of a String that starts with the given key returning its index.
public static  Stringjoin(String[] sarr, char csep)
     joins values of a string array with the given separator into a string and returns the string.
public static  Stringjoin(Object[] sarr, char csep)
    
public static  Stringjoin(List sarr, char csep)
     joins an arraylist.
public static  String[]prependString(String[] sarr, String text)
    
public static  ListprependString(List sarr, String text)
    
public static  String[]split(String st, char sep)
     splits a given string on given character separator returning an array of strings.
public static  String[]split(String st, String ssep)
    
public static  Object[]toArray(Enumeration e)
     for those bad days when you have to deal with an enumeration and you sorely need to treat is as an array or Collection.
public static  Object[]toArray(Enumeration e, Object[] a)
     If you want to put the value into an array of some particular type, pass that as a parameter.
public static  Object[]toSortedArray(Enumeration e)
    
public static  Object[]toSortedArray(Enumeration e, Object[] a)
     If you want to put the value into an array of some particular type, pass that as a parameter.
public static  String[]toStringArray(List l)
    
public static  String[]trim(String[] sarr)
     remove zero length entries from the given array - principally created for string arrays coming from JSP's.



Method Detail
appendString
public static String[] appendString(String[] sarr, String text)(Code)
append a string to each element in an array



elementAt
public static Object elementAt(Object a, int index)(Code)
identical to get (for those used to ArrayList class methods).



enclose
public static String[] enclose(String[] sarr, String before, String after)(Code)
enclose each element in an array with given strings. Useful when surrounding a string with tags



enclose
public static String enclose(String sarr, String before, String after)(Code)



get
public static Object get(Object a, int index)(Code)
returns the value at an index, a negative index denotes indexes taken from end backwards (-1 means last but one), An index higher than array size returns highest element, A negative index larger than size will return element at 0.



indexOf
public static int indexOf(Object a, Object key)(Code)
sequential search of array returning index if found, else -1. Return values start from 0. For repeated searches on a large array, please use Arrays.sort() once and then use binarySearch. However, that would work only if index does not matter.



indexOf
public static int indexOf(int a, int key)(Code)



indexOfEndsWith
public static int indexOfEndsWith(String a, String key)(Code)
searches an array of Strings that ends with the given key returning its index. e.g. EMPID, ['MGREMPID','NAME']



indexOfEndsWith
public static int indexOfEndsWith(String key, String a)(Code)
checks whether the key, ends with a string in the array given. This is a reverse of the above, returning its index. e.g. MGREMPID, ['EMPID','NAME'] RK added on 20031226 20:54:41



indexOfIndexOf
public static int indexOfIndexOf(String a, String key)(Code)
searches an array of Strings that includes the given key returning its index.



indexOfRegex
public static int indexOfRegex(String s, String pattern)(Code)
find a regex in the array and return its index, else -1. pattern should be enclosed in // with possible modifiers at end e.g. /pattern/ OR /pattern/i .



indexOfStartsWith
public static int indexOfStartsWith(String a, String key)(Code)
searches an array of a String that starts with the given key returning its index.



join
public static String join(String[] sarr, char csep)(Code)
joins values of a string array with the given separator into a string and returns the string. Does not delimit the last value, obviously.



join
public static String join(Object[] sarr, char csep)(Code)



join
public static String join(List sarr, char csep)(Code)
joins an arraylist. this should go into a new ListUtil



prependString
public static String[] prependString(String[] sarr, String text)(Code)
prepend a string to each element in an array



prependString
public static List prependString(List sarr, String text)(Code)



split
public static String[] split(String st, char sep)(Code)
splits a given string on given character separator returning an array of strings. THis would be more efficient than using string tokenizer which takes a String not char as argument.
author:
   Rahul Kumar June 17, 2001
author:
   How to deal with consecutive delimiters - i am returning blank
author:
   strings.



split
public static String[] split(String st, String ssep)(Code)
THIS WONT WORK AS EXPECTED SINCE ssep actually means each character in ssep is a delim



toArray
public static Object[] toArray(Enumeration e)(Code)
for those bad days when you have to deal with an enumeration and you sorely need to treat is as an array or Collection.



toArray
public static Object[] toArray(Enumeration e, Object[] a)(Code)
If you want to put the value into an array of some particular type, pass that as a parameter. On the lines of ArrayList.toArray(Object[])



toSortedArray
public static Object[] toSortedArray(Enumeration e)(Code)



toSortedArray
public static Object[] toSortedArray(Enumeration e, Object[] a)(Code)
If you want to put the value into an array of some particular type, pass that as a parameter. On the lines of ArrayList.toArray(Object[])



toStringArray
public static String[] toStringArray(List l)(Code)



trim
public static String[] trim(String[] sarr)(Code)
remove zero length entries from the given array - principally created for string arrays coming from JSP's. For other rare cases, i am also trimming the string and then checking its length.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.