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 type="text/javascript"> | |
console.log("ola mundo"); | |
function par(a, b) { | |
return function(f) { | |
return f(a, b); | |
} | |
} |
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
http://code.google.com/apis/ajax/playground/?type=visualization#geo_chart | |
function drawVisualization() { | |
console.log('asdad'); | |
var data = new google.visualization.DataTable(); | |
data.addColumn('string', 'City'); | |
data.addRows([ | |
['Foz do Iguacu'], |
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
class Palestrante { | |
private String name; | |
private int postsNoGuj; | |
public String getName() { | |
return name; | |
} | |
public int getPostsNoGuj() { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Layout Fixo</title> | |
<link href="style.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<div class="container"> |
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
* { | |
margin: 0; | |
padding: 0; | |
} | |
html { | |
font-family: Arial, Helvetica, sans-serif; | |
} | |
.container { |
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
public class Rainhas { | |
private static int[] rainhas = new int[8]; | |
public static void main(String[] args) { | |
tentaNaPosicao(0); | |
} | |
private static void tentaNaPosicao(int coluna) { | |
for(int linha = 0; linha < 8; linha++) { | |
if(valido(coluna, linha)) { | |
rainhas[coluna] = linha; | |
if(coluna == 7) System.out.println(Arrays.toString(rainhas)); |
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
javac br/com/casadocodigo/java8/Capitulo5.java | |
br/com/casadocodigo/java8/Capitulo5.java:44: error: variable comparator is already defined in method main(String[]) | |
Comparator<Usuario> comparator = | |
^ | |
br/com/casadocodigo/java8/Capitulo5.java:58: error: cannot find symbol | |
.thenComparing(s -> s.length()); | |
^ | |
symbol: method length() | |
location: variable s of type Object | |
br/com/casadocodigo/java8/Capitulo5.java:58: error: incompatible types: no instance(s) of type variable(s) U exist so that Comparator<Object> conforms to Comparator<String> |
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
import java.util.*; | |
import java.util.concurrent.*; | |
import java.util.function.*; | |
class EWC { | |
private Consumer<Object> tarefinha; | |
private Queue<Object> waiters = new ConcurrentLinkedQueue<>(); | |
public void wait(Object arg) { |
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<Usuario> usuariosFiltrados = new ArrayList<>(); | |
for(Usuario usuario : usuarios) { | |
if(usuario.getPontos() > 100) { | |
usuariosFiltrados.add(usuario); | |
} | |
} | |
Collections.sort(usuariosFiltrados, new Comparator<Usuario>() { | |
public int compare(Usuario u1, Usuario u2) { | |
return u1.getNome().compareTo(u2.getNome()); |
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<Usuario> filtradosOrdenados = usuarios.stream() | |
.filter(u -> u.getPontos() > 100) | |
.sorted(Comparator.comparing(Usuario::getNome)) | |
.collect(Collectors.toList()); |