Spring boot maven run with profile
mvn spring-boot:run -Drun.profiles=dev
mvn spring-boot:run -Drun.profiles=dev
public static void setPlayerInventory(Player p) { Inventory teamselector = Bukkit.createInventory(null, 9*1, “Name of the inventory”); }
String[] characters = new String[] {“$”, “@”, “B”,
class TestJava { public static void main(String[] args) { String operatingSystem = System.getProperty(“os.name”).toLowerCase(); if (operatingSystem.contains(“win”)){ System.out.println(“Operating system is Windows”); } else if (operatingSystem.contains(“osx”)){ System.out.println(“Operating system is OSX”); } else if (operatingSystem.contains(“nix”)){ System.out.println(“Operating system is NIX”); } else if (operatingSystem.contains(“nux”)){ System.out.println(“Operating system is NUX”); } else if (operatingSystem.contains(“aix”)){ System.out.println(“Operating system is *AIX”); } } } Output: … Read more
public class TestPagerAdapter extends PagerAdapter{ private Context context; public YourPagerAdapter(Context c) { this.context = c; } @Override public void onClick(View v) { FragmentActivity fragmentActivity = (FragmentActivity)(context); FragmentManager fragmentManager = fragmentActivity.getSupportFragmentManager(); TestPagerAdapter alertDialog = new YourDialogFragment(); alertDialog.show(fragmentManager, “Fragment Alert Text”); } }
Subject interestedSubject = subjects.stream() .filter(subject -> “Java”.equals(subject.getName())) .findAny() .orElse(null);
sudo apt-get install openjdk-11-jdk $ sudo update-alternatives –config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status * 0 /usr/lib/jvm/java-9-openjdk-amd64/bin/java 1500 auto mode 1 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1500 manual mode 2 /usr/lib/jvm/java-9-openjdk-amd64/bin/java 1500 manual mode
import java.awt.datatransfer.StringSelection; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; String testString = “Text that needs to be copied into clipboard”; StringSelection stringSelectionObj = new StringSelection(testString); Clipboard clipboardObj = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboardObj.setContents(stringSelectionObj, null);
/exit
long startTime = System.nanoTime(); someProcessing(); long endTime = System.nanoTime(); //timeDuration will be in milliseconds, Divide by 1000000 to get milliseconds. long timeDuration = (endTime – startTime);