Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Commit

Permalink
Added maven framework
Browse files Browse the repository at this point in the history
  • Loading branch information
Klemek committed Aug 30, 2018
1 parent 9b634f2 commit bcf6d39
Show file tree
Hide file tree
Showing 9 changed files with 869 additions and 795 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/out/
/target/
/maven-repo.bat
/.idea/
*.iml
75 changes: 75 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>fr.klemek</groupId>
<artifactId>betterlists</artifactId>
<version>1.4</version>

<name>BetterLists</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<outputDirectory>target/${project.artifactId}/WEB-INF/classes</outputDirectory>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<plugins>
<!-- Notify plugin/dependecies updates -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Compilation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- JAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<outputDirectory>download</outputDirectory>
</configuration>
</plugin>
<!-- Unit tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
package fr.klemek.betterlists;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

/**
* An extension of the java.util.ArrayList class which include some of the C#
* LINQ useful functions.
*
* @author Klemek
* @see java.util.ArrayList
*/
public class BetterArrayList<T> extends ArrayList<T> implements BetterList<T> {

private static final long serialVersionUID = 4772544470059394618L;

/**
* Constructs a list containing the elements of the specified collection, in the
* order they are returned by the collection's iterator.
*
* @param c - the collection whose elements are to be placed into this list
*/
public static <T> BetterArrayList<T> fromList(Collection<T> c) {
return new BetterArrayList<>(c);
}

/**
* Constructs a list containing the elements given in argument.
*
* @param a - the elements to be placed into this list
*/
public static <T> BetterArrayList<T> asList(T... a) {
return new BetterArrayList<>(a);
}

/**
* Constructs an empty list with an initial capacity of ten.
*/
public BetterArrayList() {
super();
}

/**
* Constructs a list containing the elements of the specified collection, in the
* order they are returned by the collection's iterator.
*
* @param c - the collection whose elements are to be placed into this list
*/
public BetterArrayList(Collection<? extends T> c) {
super(c);
}

/**
* Constructs a list containing the elements given in argument.
*
* @param a - the elements to be placed into this list
*/
public BetterArrayList(T... a) {
super(Arrays.asList(a));
}

/**
* Constructs an empty list with the specified initial capacity.
*
* @param initialCapacity - the initial capacity of the list
*/
public BetterArrayList(int initialCapacity) {
super(initialCapacity);
}

/**
* Returns a view of the portion of this list between the specified fromIndex,
* inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the
* returned list is empty.) The returned list is backed by this list, so
* non-structural changes in the returned list are reflected in this list, and
* vice-versa. The returned list supports all of the optional list operations
* supported by this list. This method eliminates the need for explicit range
* operations (of the sort that commonly exist for arrays). Any operation that
* expects a list can be used as a range operation by passing a subList view
* instead of a whole list. (see List.subList)
*
* @param fromIndex - low endpoint (inclusive) of the subList
* @param toIndex - high endpoint (exclusive) of the subList
* @return a view of the specified range within this list
* @throws IndexOutOfBoundsException for an illegal endpoint index value (fromIndex < 0 || toIndex >
* size || fromIndex > toIndex)
* @see java.util.List
*/
@Override
public BetterArrayList<T> subList(int fromIndex, int toIndex) {
return (BetterArrayList<T>) super.subList(fromIndex, toIndex);
}
}
package fr.klemek.betterlists;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

/**
* An extension of the java.util.ArrayList class which include some of the C#
* LINQ useful functions.
*
* @author Klemek
* @see java.util.ArrayList
*/
public class BetterArrayList<T> extends ArrayList<T> implements BetterList<T> {

private static final long serialVersionUID = 4772544470059394618L;

/**
* Constructs a list containing the elements of the specified collection, in the
* order they are returned by the collection's iterator.
*
* @param c - the collection whose elements are to be placed into this list
*/
public static <T> BetterArrayList<T> fromList(Collection<T> c) {
return new BetterArrayList<>(c);
}

/**
* Constructs a list containing the elements given in argument.
*
* @param a - the elements to be placed into this list
*/
public static <T> BetterArrayList<T> asList(T... a) {
return new BetterArrayList<>(a);
}

/**
* Constructs an empty list with an initial capacity of ten.
*/
public BetterArrayList() {
super();
}

/**
* Constructs a list containing the elements of the specified collection, in the
* order they are returned by the collection's iterator.
*
* @param c - the collection whose elements are to be placed into this list
*/
public BetterArrayList(Collection<? extends T> c) {
super(c);
}

/**
* Constructs a list containing the elements given in argument.
*
* @param a - the elements to be placed into this list
*/
public BetterArrayList(T... a) {
super(Arrays.asList(a));
}

/**
* Constructs an empty list with the specified initial capacity.
*
* @param initialCapacity - the initial capacity of the list
*/
public BetterArrayList(int initialCapacity) {
super(initialCapacity);
}

/**
* Returns a view of the portion of this list between the specified fromIndex,
* inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, the
* returned list is empty.) The returned list is backed by this list, so
* non-structural changes in the returned list are reflected in this list, and
* vice-versa. The returned list supports all of the optional list operations
* supported by this list. This method eliminates the need for explicit range
* operations (of the sort that commonly exist for arrays). Any operation that
* expects a list can be used as a range operation by passing a subList view
* instead of a whole list. (see List.subList)
*
* @param fromIndex - low endpoint (inclusive) of the subList
* @param toIndex - high endpoint (exclusive) of the subList
* @return a view of the specified range within this list
* @throws IndexOutOfBoundsException for an illegal endpoint index value (fromIndex < 0 || toIndex >
* size || fromIndex > toIndex)
* @see java.util.List
*/
@Override
public BetterArrayList<T> subList(int fromIndex, int toIndex) {
return (BetterArrayList<T>) super.subList(fromIndex, toIndex);
}
}
Loading

0 comments on commit bcf6d39

Please sign in to comment.