StringArrayUtils.java 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /**
  2. * Created by leon on 1/29/18.
  3. */
  4. public class StringArrayUtils {
  5. /**
  6. * @param array array of String objects
  7. * @return first element of specified array
  8. */ // TODO
  9. public static String getFirstElement(String[] array) {
  10. return null;
  11. }
  12. /**
  13. * @param array array of String objects
  14. * @return second element in specified array
  15. */
  16. public static String getSecondElement(String[] array) {
  17. return null;
  18. }
  19. /**
  20. * @param array array of String objects
  21. * @return last element in specified array
  22. */ // TODO
  23. public static String getLastElement(String[] array) {
  24. return null;
  25. }
  26. /**
  27. * @param array array of String objects
  28. * @return second to last element in specified array
  29. */ // TODO
  30. public static String getSecondToLastElement(String[] array) {
  31. return null;
  32. }
  33. /**
  34. * @param array array of String objects
  35. * @param value value to check array for
  36. * @return true if the array contains the specified `value`
  37. */ // TODO
  38. public static boolean contains(String[] array, String value) {
  39. return false;
  40. }
  41. /**
  42. * @param array of String objects
  43. * @return an array with identical contents in reverse order
  44. */ // TODO
  45. public static String[] reverse(String[] array) {
  46. return null;
  47. }
  48. /**
  49. * @param array array of String objects
  50. * @return true if the order of the array is the same backwards and forwards
  51. */ // TODO
  52. public static boolean isPalindromic(String[] array) {
  53. return false;
  54. }
  55. /**
  56. * @param array array of String objects
  57. * @return true if each letter in the alphabet has been used in the array
  58. */ // TODO
  59. public static boolean isPangramic(String[] array) {
  60. return false;
  61. }
  62. /**
  63. * @param array array of String objects
  64. * @param value value to check array for
  65. * @return number of occurrences the specified `value` has occurred
  66. */ // TODO
  67. public static int getNumberOfOccurrences(String[] array, String value) {
  68. return 0;
  69. }
  70. /**
  71. * @param array array of String objects
  72. * @param valueToRemove value to remove from array
  73. * @return array with identical contents excluding values of `value`
  74. */ // TODO
  75. public static String[] removeValue(String[] array, String valueToRemove) {
  76. return null;
  77. }
  78. /**
  79. * @param array array of chars
  80. * @return array of Strings with consecutive duplicates removes
  81. */ // TODO
  82. public static String[] removeConsecutiveDuplicates(String[] array) {
  83. return null;
  84. }
  85. /**
  86. * @param array array of chars
  87. * @return array of Strings with each consecutive duplicate occurrence concatenated as a single string in an array of Strings
  88. */ // TODO
  89. public static String[] packConsecutiveDuplicates(String[] array) {
  90. return null;
  91. }
  92. }