range literals initial
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package jet;
|
||||
|
||||
public class IntRange implements Range<Integer> {
|
||||
private final int startValue;
|
||||
private final int endValue;
|
||||
|
||||
public IntRange(int startValue, int endValue) {
|
||||
this.startValue = startValue;
|
||||
this.endValue = endValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Integer item) {
|
||||
if (item == null) return false;
|
||||
if (startValue <= endValue) {
|
||||
return item >= startValue && item <= endValue;
|
||||
}
|
||||
return item <= startValue && item >= endValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package jet;
|
||||
|
||||
public interface Range<T extends Comparable<T>> {
|
||||
boolean contains(T item);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
Reference in New Issue
Block a user