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
List<Integer> list = new ArrayList<Integer>() | |
list.add(1) | |
list.add(2) | |
list.add(3) | |
list = Collections.unmodifiableList(list) | |
Collections.unmodifiableList(new ArrayList<>(Arrays.asList(1,2,3))) | |
Collections.unmodifiableList(Stream.of(1,2,3).collect(toList())) | |
Collections.unmodifiableList(new ArrayList<Integer>() {{ add(1); add(2); add(3); }}) | |
/env -class-path guava-27.1-jre.jar | |
import com.google.common.collect.ImmutableList |
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
Thread = new Thread(() -> System.out.println("hello confoo")) | |
Thread t = new Thread(() -> System.out.println("hello confoo")) | |
t.start() | |
ExecutorService e = Executors.newSingleThreadExecutor() | |
Future<String> f = e.submit(() -> "hello confoo") | |
f | |
f.get() | |
ExecutorService e = ForkJoinPool.commonPool() | |
Future<String> f = e.submit(() -> "hello confoo") | |
f.get() |
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
List<Integer> list = new ArrayList<Integer>() | |
list.add(1) | |
list.add(2) | |
list.add(3) | |
list = Collections.unmodifiableList(list) | |
List<Integer> list2 = new ArrayList<Integer>(list) | |
List<Integer> list2 = Collections.unmodifiableList(new ArrayList<Integer>(list)) | |
List<Integer> list = List.of(1,2,3) | |
list.add(4) | |
list.getClass() |
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
List<Integer> list = new ArrayList<Integer>() | |
list.add(1) | |
list.add(2) | |
list.add(3) | |
list = Collections.unmodifiableList(list) | |
List<Integer> list2 = new ArrayList<Integer>(list) | |
List<Integer> list2 = Collections.unmodifiableList(new ArrayList<Integer>(list)) | |
List<Integer> list = List.of(1,2,3) | |
list.add(4) | |
List<Integer> list2 = List.copyOf(list) |
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
language: java | |
dist: trusty | |
sudo: false | |
jdk: | |
- openjdk8 | |
env: | |
- GH_URL=https://raw.githubusercontent.com VALIDATOR_URL=http://localhost:8080/validator/debug?url FILE_TO_VALIDATE=openapi.yaml URL_TO_VALIDATE=$GH_URL/${TRAVIS_PULL_REQUEST_SLUG:-$TRAVIS_REPO_SLUG}/${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}/$FILE_TO_VALIDATE | |
before_install: | |
# Build and start validator-badge. This setup will not be needed once the online version of validator-badge supports OAS 3.0. Until then we'll need to set up a local version. | |
- git clone --branch=v2.0.0 https://github.com/swagger-api/validator-badge.git |
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
script: | |
# validate | |
- echo "Validating $URL_TO_VALIDATE:" | |
- VALIDATION_OUTPUT=`curl -sS "$VALIDATOR_URL=$URL_TO_VALIDATE"` | |
# print validation errors | |
- echo $VALIDATION_OUTPUT | |
# check if the validation output ignoring warnings is an empty array | |
- VALIDATION_ERROR_COUNT=`echo "$VALIDATION_OUTPUT" |jq -c '.schemaValidationMessages // [] | map(select(.level != "warning"))' |jq length` |
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
before_install: | |
# Build and start validator-badge. This setup will not be needed once the online version of validator-badge supports OAS 3.0. Until then we'll need to set up a local version. | |
- git clone --branch=v2.0.0 https://github.com/swagger-api/validator-badge.git | |
- cd validator-badge | |
- mvn package -q -DskipTests=true -Dmaven.javadoc.skip=true -B -V jetty:run & | |
- cd .. | |
- sleep 60 |
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
env: | |
- GH_URL=https://raw.githubusercontent.com VALIDATOR_URL=http://localhost:8080/validator/debug?url FILE_TO_VALIDATE=openapi.yaml URL_TO_VALIDATE=$GH_URL/${TRAVIS_PULL_REQUEST_SLUG:-$TRAVIS_REPO_SLUG}/${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}/$FILE_TO_VALIDATE |
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
language: java | |
dist: trusty | |
sudo: false | |
jdk: | |
- openjdk8 |
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
env: | |
- FILE_URL=https://raw.githubusercontent.com/${TRAVIS_PULL_REQUEST_SLUG:-$TRAVIS_REPO_SLUG}/${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}/{FILE_PATH} | |