This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models; | |
import java.util.Map; | |
import java.util.List; | |
import java.util.ArrayList; | |
import org.junit.Test; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Assert; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NaturalSort { | |
public static Integer firstNumberOccurrenceFor(String string) { | |
java.util.regex.Matcher matcher = java.util.regex.Pattern.compile("^\\D*(\\d+).*").matcher(string); | |
matcher.find(); | |
return Integer.valueOf(matcher.group(1)); | |
} | |
public static java.util.List<String> naturalSort(java.util.List<String> items) { | |
java.util.List<String> sortedItems = new java.util.ArrayList<String>(items); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.forrst</groupId> | |
<artifactId>akka_forrst</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<name>question-at-forrst</name> | |
<repositories> | |
<repository> |