Skip to content

Commit

Permalink
finished basic array utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim L authored and Tim L committed Jul 8, 2024
1 parent 0e4b5e0 commit 67b5a37
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,34 @@ public class BasicArrayUtils {
* @return the first element in the array
*/
public static String getFirstElement(String[] stringArray) {
return null;
return stringArray[0];
// return null;
}

/**
* @param stringArray an array of String objects
* @return the second element in the array
*/
public static String getSecondElement(String[] stringArray) {
return null;
return stringArray[1];
// return null;
}

/**
* @param stringArray an array of String objects
* @return the last element in the array
*/
public static String getLastElement(String[] stringArray) {
return null;
return stringArray[stringArray.length -1];
// return null;
}

/**
* @param stringArray an array of String objects
* @return the second to last element in the array
*/
public static String getSecondToLastElement(String[] stringArray) {
return null;
return stringArray[stringArray.length -2];
// return null;
}
}

0 comments on commit 67b5a37

Please sign in to comment.