JAVA
List<Integer> even = new ArrayList<Integer>();
for (String num : numbersAsStrings) {
int parsedInt = Integer.parseInt(num);
if (parsedInt % 2 == 0) {
ints.add(parsedInt);
}
} | /* | |
| * Copyright (C) 2011 47 Degrees, LLC | |
| * http://47deg.com | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * |
| /* | |
| * Copyright (C) 2011 47 Degrees, LLC | |
| * http://47deg.com | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * |
| /* | |
| * Copyright (C) 2011 47 Degrees, LLC | |
| * http://47deg.com | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * |
| public class EarthService { | |
| private final static EarthService instance = new EarthService(); | |
| private EarthService() { | |
| } | |
| public final static EarthService getInstance() { | |
| return instance; | |
| } |
| interface PersistenceService { | |
| void save(); | |
| } | |
| class DatabasePersistenceService implements PersistenceService { | |
| public void save() { | |
| // save to database | |
| } |
| interface SolidObject { | |
| void applyGravity(); | |
| void colide(SolidObject other); | |
| } | |
| interface MovingObject { | |
| void run(); | |
| void stop(); | |
| } |
| interface PersistenceService { | |
| Object save(Object obj); | |
| } | |
| class DatabasePersistenceService implements PersistenceService { | |
| @Override | |
| public Object save(Object obj) { | |
| //save to the database | |
| return null; |
| package services | |
| import akka.actor.Actor._ | |
| import com.typesafe.plugin._ | |
| import akka.actor.{Props, OneForOneStrategy, Actor} | |
| import play.api.libs.concurrent.Akka | |
| import play.api.Play.current | |
| case class EmailMessage(subject: String, recipient: String, from: String, text: String, html: String) |
| /* | |
| * Copyright (C) 2012 47 Degrees, LLC | |
| * http://47deg.com | |
| * hello@47deg.com | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 |
JAVA
List<Integer> even = new ArrayList<Integer>();
for (String num : numbersAsStrings) {
int parsedInt = Integer.parseInt(num);
if (parsedInt % 2 == 0) {
ints.add(parsedInt);
}
}