This file contains 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
class SimpleSnipetJUnitTest { | |
private Calculator calculator; | |
/** | |
* Este método é invocado antes de cada teste, a annotation | |
* facilita isso | |
*/ | |
@Before | |
public void setUp() { | |
//Tudo aqui será executado antes, servindo por exemplo para inicializar. | |
calculator = new Calculator(); |
This file contains 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
package br.com.lucaspolo.genius; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Genius { | |
private static Scanner scanner; |
This file contains 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
import java.util.List; | |
import java.util.ArrayList; | |
//This interface apply a pre-condition | |
interface Predicate<T>{ | |
boolean test(T t); | |
} | |
//This interface apply a modification on element | |
interface Function<E, S> { |
This file contains 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
public static void matriz() { | |
int [][] vetor = new int[5][5]; | |
int tamanhoVetor = vetor.length; | |
int tamanhoSubVetor = vetor[1].length; | |
int tamanho = tamanhoVetor * tamanhoSubVetor; | |
for(int i = 0; i < tamanho; i++) { | |
int indiceDoSubvetor = i % tamanhoVetor; | |
int indiceDoVetor = (i - indiceDoSubvetor) / tamanhoSubVetor; | |
System.out.println("Vetor: " + indiceDoVetor + " Subvetor: " + indiceDoSubvetor); |
This file contains 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
package br.com.alura.loja; | |
import java.io.IOException; | |
import java.net.URI; | |
import org.glassfish.grizzly.http.server.HttpServer; | |
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; | |
import org.glassfish.jersey.server.ResourceConfig; | |
public class Servidor { |
This file contains 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
package br.com.alura.loja.dao; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.concurrent.atomic.AtomicLong; | |
import br.com.alura.loja.modelo.Carrinho; | |
import br.com.alura.loja.modelo.Produto; | |
public class CarrinhoDAO { |
This file contains 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
<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>br.com.lucaspolo.json</groupId> | |
<artifactId>teste</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>teste</name> |
This file contains 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
package br.com.lucaspolo.json.teste; | |
import java.net.URI; | |
import java.net.URISyntaxException; | |
import java.util.HashMap; | |
import java.util.Map; | |
import javax.naming.LimitExceededException; | |
import javax.ws.rs.client.Client; | |
import javax.ws.rs.client.ClientBuilder; |
This file contains 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
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* Esta classe testa o Stream que é do Java 8 e seu irmão multi-thread ParallelStream | |
* Os resultados são controversos, algumas vezes o tempo é igual, outras o paralelo é mais rápido (metade do tempo). | |
* Ainda não verifiquei na documentação quais são os critérios. | |
**/ | |
public class Main { |
This file contains 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
#!/usr/bin/env python | |
import web, serial | |
urls = ( | |
'/arduino', 'arduino' | |
) | |
app = web.application(urls, globals()) | |
ligado = 0 |
OlderNewer