Clover Coverage Report - Atlassian Core
Coverage timestamp: Sun Nov 30 2008 18:33:35 CST
10   48   5   5
6   30   0.5   2
2     2.5  
1    
 
 
  ArrayUtils       Line # 8 10 5 0% 0.0
 
No Tests
 
1    package com.atlassian.core.util.collection;
2   
3    import org.apache.commons.lang.StringUtils;
4   
5    /**
6    * Collection of useful Array methods
7    */
 
8    public class ArrayUtils
9    {
10    /**
11    * Adds a string to an array and resizes the array. Method is null safe.
12    * @param array - original array
13    * @param obj - String to add
14    * @return an array with the new straing addded to the end
15    */
 
16  0 toggle public static String[] add(String[] array, String obj)
17    {
18  0 if (array != null)
19    {
20  0 String[] newArray = new String[array.length + 1];
21  0 for (int i = 0; i < array.length; i++)
22    {
23  0 newArray[i] = array[i];
24    }
25  0 newArray[array.length] = obj;
26   
27  0 return newArray;
28    }
29  0 else if (obj != null)
30    {
31  0 return new String[]{obj};
32    }
33    else
34    {
35  0 return null;
36    }
37    }
38   
39    /**
40    * Checks if the array is not null, and contains one and only one element, which is blank (see {@link StringUtils#isBlank})
41    * @param array
42    * @return true or false
43    */
 
44  0 toggle public static boolean isContainsOneBlank(String[] array)
45    {
46  0 return array != null && array.length == 1 && StringUtils.isBlank(array[0]);
47    }
48    }