Skip to content

codeecho/fixture-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fixture Generator

A Java library for creating fixture lists.

The following Java code...

FixtureGenerator<String> fixtureGenerator = new FixtureGenerator();
List<String> teams = new LinkedList<String>();
teams.add("Team 1");
teams.add("Team 2");
teams.add("Team 3");
teams.add("Team 4");
List<List<Fixture<String>>> rounds = fixtureGenerator.getFixtures(teams, true);
for(int i=0; i<rounds.size(); i++){
    System.out.println("Round " + (i+1));
    List<Fixture<String>> round = rounds.get(i);
    for(Fixture<String> fixture: round){
        System.out.println(fixture.getHomeTeam() + " vs " + fixture.getAwayTeam());
    }
    System.out.println("");
}

Will create the following output...

Round 1
Team 1 vs Team 4
Team 2 vs Team 3

Round 2
Team 4 vs Team 3
Team 1 vs Team 2

Round 3
Team 2 vs Team 4
Team 3 vs Team 1

Round 4
Team 4 vs Team 1
Team 3 vs Team 2

Round 5
Team 3 vs Team 4
Team 2 vs Team 1

Round 6
Team 4 vs Team 2
Team 1 vs Team 3

The first argument to FixtureGenerator.getFixtures can be a list of any type of objects and it will pair the objects into fixtures. The second argument is a boolean value and determines whether or not the reverse fixtures should be included in the results.

About

A Java library for creating fixture lists.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages