Question: Ternary Statement A ternary operator is a conditional operator that can be used as an alternative to an if - else condition or for switch

Ternary Statement
A ternary operator is a conditional operator that can be used as an alternative to an if-else condition or for switch statements. It's benefits include being more concise, cleaner and taking up less space in code. More information about ternary operator can be found at this tutorial with examples.
The syntax for a ternary operator is as follows:
variable = expression1? expression2: expression3
An example of a ternary statement in MyLinkedList is shown below.
public E getFirst(){
return size ==0? null : head.element;
}
Note: You should not do nested ternary statements.
Pair
Pair is the return used in the contains method in the
/src/main/java/MyLinkedList.java file. There are several methods that can be used with Pairs. To learn more about Pairs click here. To learn more about Tuples see the link listed below in resources.
Required Tasks
To complete this assignment you must do the following:
Finish the implementation in MyAbstractList.java and MyLinkedList.java
There should be at least three tests total for each test file.
All tests should pass.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!