This program is designed to provide a matcher that compares strings ending in sequences of digits in
Fantastic news! We've Found the answer you've been seeking!
Question:
This program is designed to provide a matcher that compares strings ending in sequences of digits in a way that makes sense to a human. Explain step by step what was developed in the DirectoryComparator file to understand how it works.
Transcribed Image Text:
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class DirectorySortDemo { public static void main(String[] args) { } } String[] dirNames = {"dir12", "dir5", "dir9", "dir1", "dir4", "lab10", "lab2", "lab7", "lab17", "lab8", "quiz8", "quiz10", "quiz11", "quiz12", "dir11", "dir8", "dir7", "dir15", "dir3"}; ArrayList<String> directories = new ArrayList<>(Arrays.asList(dirNames)); System.out.println("Unsorted List:"); System.out.println(directories); Collections.sort(directories, new DirectoryComparator()); System.out.println(); System.out.println("Sorted List:"); System.out.println(directories); import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class DirectorySortDemo { public static void main(String[] args) { } } String[] dirNames = {"dir12", "dir5", "dir9", "dir1", "dir4", "lab10", "lab2", "lab7", "lab17", "lab8", "quiz8", "quiz10", "quiz11", "quiz12", "dir11", "dir8", "dir7", "dir15", "dir3"}; ArrayList<String> directories = new ArrayList<>(Arrays.asList(dirNames)); System.out.println("Unsorted List:"); System.out.println(directories); Collections.sort(directories, new DirectoryComparator()); System.out.println(); System.out.println("Sorted List:"); System.out.println(directories); import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class DirectorySortDemo { public static void main(String[] args) { } } String[] dirNames = {"dir12", "dir5", "dir9", "dir1", "dir4", "lab10", "lab2", "lab7", "lab17", "lab8", "quiz8", "quiz10", "quiz11", "quiz12", "dir11", "dir8", "dir7", "dir15", "dir3"}; ArrayList<String> directories = new ArrayList<>(Arrays.asList(dirNames)); System.out.println("Unsorted List:"); System.out.println(directories); Collections.sort(directories, new DirectoryComparator()); System.out.println(); System.out.println("Sorted List:"); System.out.println(directories); import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; public class DirectorySortDemo { public static void main(String[] args) { } } String[] dirNames = {"dir12", "dir5", "dir9", "dir1", "dir4", "lab10", "lab2", "lab7", "lab17", "lab8", "quiz8", "quiz10", "quiz11", "quiz12", "dir11", "dir8", "dir7", "dir15", "dir3"}; ArrayList<String> directories = new ArrayList<>(Arrays.asList(dirNames)); System.out.println("Unsorted List:"); System.out.println(directories); Collections.sort(directories, new DirectoryComparator()); System.out.println(); System.out.println("Sorted List:"); System.out.println(directories);
Expert Answer:
Answer rating: 100% (QA)
The DirectoryComparator class is a custom comparator that sorts the directory names based on the num... View the full answer
Related Book For
Business and Administrative Communication
ISBN: 978-0073403182
10th edition
Authors: Kitty o. locker, Donna s. kienzler
Posted Date:
Students also viewed these programming questions
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Your organization has decided to institute a suggestion system. Employees on hourly pay scales will be asked to submit suggestions. (Managers and other employees on salary are not eligible for this...
-
Predictive text entry systems are familiar on touch screens and mobile phones. This question asks you to consider how the same principles might be used in a programming editor for creating Java code....
-
Jake's office building is destroyed by a fire on September 15, 2022. Jake receives insurance proceeds on April 15, 2023 in the amount of $300,000. Jake's adjusted basis in the building was $250,000....
-
Should Banneker develop the philanthropic or educational side of The Banneker Model? Is this philanthropic side of the model feasible?
-
Airlines sometimes overbook flights. Suppose that for a plane with 100 seats, an airline takes 110 reservations. Define the variable x as the number of people who actually show up for a sold-out...
-
According to Colliers International, the median monthly parking rate in the United States for 2012 was \(\$ 164.80\). The data in Table 7 represent a random sample of monthly parking rates in...
-
Classify the following as direct materials, direct labor, factory overhead, or selling and administrative expense. a. Steel used in an overhead door plant. b. Cloth used in a shirt factory. c....
-
Can you elaborate on the role of deferred constraint checking in PostgreSQL transactions, its implications for concurrency control, and how it can be utilized to achieve consistency in complex data...
-
A string of length 0.80 m is fixed at both ends. The diagram shows a standing wave formed on the string. P and Q are two particles on the string. 0.8 The variation with time t of the displacement of...
-
You will complete this assignment based on the difference between the standard and itemized deductions and their appropriate application, the steps prescribed in the tax law to determine tax...
-
Williamson, Inc., manufactures digital voice recorders. During 2016, total costs associated with manufacturing 202,500 of the new EZ 9900 model (introduced this year) were as follows: Raw materials $...
-
You are provided with the following information for Tamarisk, Inc. Tamarisk, Inc. uses the periodic system of accounting for its inventory transactions. March 1 Beginning inventory 2,075 liters at a...
-
Why can't large enterprise organizations that engage in Agile simply use dedicated teams? What needs to be done to adapt? Explain your answer.
-
Data for one of the Hawkins Company products is as follows: Item Amount Maximum capacity 109,500 units Current sales level 70,000 units Selling price $41.50 Variable production costs (per unit) 21.75...
-
A diffraction grating has 25000 lines per centimeter and is illuminated with light of 200 nm. Compute the (a) maximum order of bright fringes can be seen on the screen. (b) angle produced by the...
-
A mass weighing 16 pounds is attached to a 5-foot long spring. At equilibrium, the spring measures 8.2 feet (In Hooke's law Fs=kx, we need to replace it with 8.2-5=3.2 ft. If the mass is is initially...
-
Write electron configurations for the following ions, and determine which have noble-gas configurations: (a) Cd2+ (b) p3- (c) Zr4+ (d) Ru3+ (e) As3- (f) Ag+
-
What preparations should you make before an interview?
-
What is groupthink? Have you ever experienced it?
-
How do you organize persuasive problem-solving messages?
-
In order to determine how e ective a magazine is at reaching its target audience, a market research company selects a random sample of people from the target audience and interviews them. Out of the...
-
Let \(Y\) be distributed according to the gamma(12 4) distribution. (a) Find \(\mathrm{E}[Y]\). (b) Find \(\operatorname{Var}[Y]\). (c) Find \(P(Y\)
-
Let \(Y\) be distributed according to the \(\operatorname{gamma}(265)\) distribution. (a) Find \(\mathrm{E}[Y]\). (b) Find \(\operatorname{Var}[Y]\). (c) Find \(P(Y>5)\)
Study smarter with the SolutionInn App