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.Stack; | |
public class Stack_MiniStack { | |
//声明一个data栈 | |
private static Stack<Integer> dataStack = new Stack<>(); | |
//声明一个min栈 | |
private static Stack<Integer> minStack = new Stack<>(); | |
//入栈 |
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.LinkedList; | |
import java.util.Queue; | |
import java.util.Stack; | |
public class TreeMap_LevelOrder { | |
class BST<E extends Comparable<E>> { | |
private class Node { | |
public E e; | |
public Node left, right; |
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.Stack; | |
import java.util.Queue; | |
import java.util.LinkedList; | |
public class TreeMap { | |
class BST<E extends Comparable<E>> { | |
private class Node { | |
public E e; | |
public Node left, right; |
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 class LinkedList_reverse { | |
public static void main(String[] args) { | |
Node head = new Node(0); | |
Node node1 = new Node(1); | |
Node node2 = new Node(2); | |
Node node3 = new Node(3); | |
head.setNext(node1); | |
node1.setNext(node2); | |
node2.setNext(node3); |
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 Callback; | |
public interface Callback { | |
void event(String result); | |
} | |
public class Callback_Test { |
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; | |
public class Even_Odd_Array { | |
static int[] array = {5, 6, 7, 8}; | |
public static class Solution { | |
public static void reOrderArray(int[] array) { |
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
//链接:https://www.zhihu.com/question/47045239/answer/105086885 | |
public abstract class BaseFragment extends Fragment implements OnClickListener { | |
private boolean isDebug; | |
private String APP_NAME; | |
protected final String TAG = this.getClass().getSimpleName(); | |
private View mContextView = null; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
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
//链接:https://www.zhihu.com/question/47045239/answer/105086885 | |
public abstract class BaseActivity extends FragmentActivity implements | |
OnClickListener { | |
/** 是否沉浸状态栏 **/ | |
private boolean isSetStatusBar = true; | |
/** 是否允许全屏 **/ | |
private boolean mAllowFullScreen = true; | |
/** 是否禁止旋转屏幕 **/ | |
private boolean isAllowScreenRoate = false; |
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
//链接:https://www.zhihu.com/question/47045239/answer/105086885 | |
public abstract class BaseActivity extends FragmentActivity implements | |
OnClickListener { | |
/** 是否沉浸状态栏 **/ | |
private boolean isSetStatusBar = true; | |
/** 是否允许全屏 **/ | |
private boolean mAllowFullScreen = true; | |
/** 是否禁止旋转屏幕 **/ | |
private boolean isAllowScreenRoate = false; |
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
abstract class Animal { | |
protected boolean isMammal; | |
protected boolean isCarnivorous; | |
public Animal(boolean isMammal, boolean isCarnivorous) { | |
this.isMammal = isMammal; | |
this.isCarnivorous = isCarnivorous; | |
} | |
public boolean getIsMammal() { |