Last change
on this file since 9874 was 9874, checked in by kjdon, 19 years ago |
merged from branch ant-install-branch: merge 1
|
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.0 KB
|
Line | |
---|
1 | /*
|
---|
2 | * Created on Dec 5, 2004
|
---|
3 | * Copyright (C) Andrea Schweer, 2004
|
---|
4 | *
|
---|
5 | * This file is part of the Greenstone Alerting Service.
|
---|
6 | * Refer to the COPYING file in the base directory of this package
|
---|
7 | * for licensing information.
|
---|
8 | */
|
---|
9 | package org.greenstone.gsdlas.util;
|
---|
10 |
|
---|
11 | import java.util.Arrays;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * @author andrea
|
---|
15 | *
|
---|
16 | * TODO To change the template for this generated type comment go to
|
---|
17 | * Window - Preferences - Java - Code Style - Code Templates
|
---|
18 | */
|
---|
19 | public class ArrayHelper {
|
---|
20 | static public boolean contains(String[] array, String element) {
|
---|
21 | if (array == null || element == null) {
|
---|
22 | return false;
|
---|
23 | }
|
---|
24 | Arrays.sort(array);
|
---|
25 | int index = Arrays.binarySearch(array, element);
|
---|
26 | return index > -1 && index <= array.length;
|
---|
27 | }
|
---|
28 |
|
---|
29 | static public String toString(String [] array) {
|
---|
30 | StringBuffer buffer = new StringBuffer();
|
---|
31 | buffer.append("[");
|
---|
32 | for (int i=0; i<array.length; i++) {
|
---|
33 | buffer.append((String)array[i]);
|
---|
34 | buffer.append(",");
|
---|
35 | }
|
---|
36 | buffer.append("]");
|
---|
37 | return buffer.toString();
|
---|
38 |
|
---|
39 | }
|
---|
40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.