Question: Write the method getDelimitersList in the code below. The main method contains code to test your solution.Save & RunLoad HistoryShow CodeLens import java.util.*; public class
Write the method getDelimitersList in the code below. The main method contains code to test your solution.Save & RunLoad HistoryShow CodeLens
import java.util.*; public class Delimiters {
/** The open and close delimiters **/ private String openDel; private String closeDel;
/** Constructs a Delimiters object were open is the open delimiter and close is the * close delimiter. * Precondition: open and close are non-empty strings */ public Delimiters (String open, String close) { openDel = open; closeDel = close; }
/** Returns an ArrayList of delimiters from the array tokens, as described in part (a). */ public ArrayList
public static void main(String[] args) { Delimiters d1 = new Delimiters("(", ")"); String[] tokens = {"(", "x + y", ")", " * 5" }; ArrayList
Delimiters d2 = new Delimiters("", "
"); String[] tokens2 = {"", "yy", "
", "zz", ""}; ArrayList,
, ] and it prints " + res2); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
