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
// Opção 1 | |
if(null != obj | |
&& null != obj.getA() | |
&& null != obj.getA().getB() | |
&& null != obj.getA().getB().get("c") ){ | |
String valor = obj.getA().getB().get("c"); | |
// faz alguma coisa com o valor | |
} else { |
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
/** Faz uma janela parecida com jQueryUI.dialog(); */ | |
$(".janela") | |
.wrap( $("<div />").css({"position":"static"}).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all") ) | |
.filter("[title]") | |
.each(function (index, elem){ | |
$(elem).parent(".ui-dialog") | |
.width( $(elem).width() ) | |
.height( $(elem).height() ) | |
.prepend("<div class='ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix'>"+ $(elem).attr("title") +"</div>"); | |
$(elem).removeAttr("title"); |
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
/** | |
* Imagine que você queira mostrar a frase "N registros atualizados", mas pode ser apenas 1 registro, então o correto seria "1 registro atualizado" (no singular) | |
* Este método serve para ajudar a formar frases que podem variar entre plural e singular. | |
* O exemplo acima seria feito assim: | |
* StringUtil.pural("Um registro atualizado", "%s registros atualizado", quantidade); | |
* @param singular | |
* @param plural | |
* @param quantidade | |
* @return |
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
//10x menos itens no loop | |
--------------------Operador + ----------------------------- | |
17:13:27:330 | |
17:14:07:718 | |
tempo : 80388 | |
-------------------String Format---------------------------- | |
17:14:07:723 | |
17:15:55:196 | |
tempo : 147473 | |
-------------------String concat---------------------------- |
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 Vazio { | |
public static boolean sim(Object object) { | |
return object == null; | |
} | |
public static boolean nao(Object object) { | |
return !sim(object); | |
} | |
} |
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
private Map<String, Object> splitDescricao(Object textDesc) { | |
Map<String, Object> newParam = new HashMap(); | |
if (textDesc != null) { | |
String[] descricao = textDesc.toString().split(" "); | |
switch (descricao.length) { | |
case 1: | |
newParam.put("descricaoSrc1", descricao[0]); | |
break; | |
case 2: | |
newParam.put("descricaoSrc1", descricao[0]); |
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
<c:set var="action" value="saveUpdate.do" /> | |
<c:if test="${empty SqlRotina.idSqlRotina}"> | |
<c:set var="action" value="saveInsert.do" /> | |
</c:if> | |
<form action="${action}" method="post"> | |
... | |
</form> |
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
package certificacao; | |
public abstract class ClassA { | |
public void run(){ | |
System.out.println("running..."); | |
} | |
} |
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
package integer; | |
public class MaxInt { | |
public static void main(String[] args) { | |
Integer i = Integer.MAX_VALUE - 10; | |
for(int x=0; x<20; x++){ | |
System.out.println( i++ ); | |
} |