id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com apcsa-comparestrings > apcsaStringComparePairSwap
prev  |  next  |  chance

Given an ArrayList with two String values, decide if they are in order or not by using the compareTo method of the String class. If not, swap them so that they are in order. Return the modified ArrayList.


apcsaStringComparePairSwap(["b", "a"]) → ["a", "b"]
apcsaStringComparePairSwap(["a", "b"]) → ["a", "b"]
apcsaStringComparePairSwap(["cat", "can"]) → ["can", "cat"]

...Save, Compile, Run (ctrl-enter)

public List<String> apcsaStringComparePairSwap(ArrayList<String> lst) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 210

Copyright Nick Parlante 2017 - privacy