zoukankan      html  css  js  c++  java
  • 求推荐一个 Android 系统上可以和电脑互传文件的应用

    https://www.v2ex.com/t/689044

    package com.example.genericparadigmdemo.paradigm.calculator;
    
    public interface Calculator<T> {
    
    //泛型
        public T add(T operand1, T operand2);
    
        public T addMany(T...operands);
    
        public T sub(T operand1, T operand2);
    
        public T multiplication(T...operands);
    }
    
    package com.example.genericparadigmdemo.paradigm.calculator;
    
    import org.springframework.stereotype.Component;
    
    @Component
    public class IntegerCalculator implements Calculator<Integer> {
        @Override
        public Integer add(Integer operand1, Integer operand2) {
            return operand1 + operand2;
        }
    
        @Override
        public Integer addMany(Integer... operands) {
            Integer result = 0;
            for (Integer oper : operands) {
                result += oper;
            }
            return result;
        }
    
        @Override
        public Integer sub(Integer operand1, Integer operand2) {
            return operand1 - operand2;
        }
    
        @Override
        public Integer multiplication(Integer... operands) {
            Integer result = 1;
            for (Integer oper : operands) {
                result *= oper;
            }
            return result;
        }
    
    
        public static void main(String[] args) {
            IntegerCalculator c1 = new IntegerCalculator();
            System.out.println(c1.add(1, 2));
    
            Calculator<Integer> c2 = new IntegerCalculator();
            System.out.println(c2.add(3, 4));
    
            Calculator<Integer> c3 = new IntegerCalculator();
            System.out.println(c3.multiplication(3,2,2));
    
            Calculator<Integer> c4 = new IntegerCalculator();
            System.out.println(c4.addMany(1,2,311,412,3,21,3));
        }
    }
    
    
    package com.example.genericparadigmdemo.paradigm.calculator;
    
    import com.example.genericparadigmdemo.paradigm.ParadigmFormatter;
    
    public class IntervalCalculator implements Calculator<ParadigmFormatter<Integer>> {
        @Override
        public ParadigmFormatter<Integer> add(ParadigmFormatter<Integer> operand1, ParadigmFormatter<Integer> operand2) {
            int lower = operand1.getLower() + operand2.getLower();
            int upper = operand1.getUpper() + operand2.getUpper();
            return new ParadigmFormatter<Integer>(lower,upper);
        }
    
        public static void main(String[] args) {
            Calculator<ParadigmFormatter<Integer>> c = new IntervalCalculator();
            ParadigmFormatter<Integer> operand1 = new ParadigmFormatter<>(1,2);
            ParadigmFormatter<Integer> operand2 = new ParadigmFormatter<>(3,4);
            ParadigmFormatter<Integer> operand3 = c.add(operand1, operand2);
            System.out.println(operand3.getLower());
        }
    
        @Override
        public ParadigmFormatter<Integer> addMany(ParadigmFormatter<Integer>... operands) {
            return null;
        }
    
        @Override
        public ParadigmFormatter<Integer> sub(ParadigmFormatter<Integer> operand1, ParadigmFormatter<Integer> operand2) {
            return null;
        }
    
        @Override
        public ParadigmFormatter<Integer> multiplication(ParadigmFormatter<Integer>... operands) {
            return null;
        }
    }
    
    
    package com.example.genericparadigmdemo.paradigm.calculator;
    
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Controller;
    import org.springframework.web.bind.annotation.RestController;
    
    @RestController
    public class OperationController {
    
    
    }
    
    
    package com.example.genericparadigmdemo.paradigm;
    
    public class ParadigmFormatter<T> {
    
        private T lower;
        private T upper;
    
        public ParadigmFormatter(T lower, T upper){
            this.lower = lower;
            this.upper = upper;
        }
    
        public T getLower(){
            return lower;
        }
    
        public T getUpper(){
            return upper;
        }
    
    }
    
    
  • 相关阅读:
    mysql-5-aggregation
    mysql-4-functions
    mysql-3-orderby
    技术之心 | 云信和TA们携手打响防疫战
    疫情下的传统商企自救|4个Tips搭建销量过亿直播间
    那些2019年会爆发的泛娱乐黑科技风口
    流量难、获客难、增长难?增长黑客思维“解救”B端业务
    【翻译】Facebook全面推出Watch Party,可多人线上同看直播视频
    深入浅出聊一聊Docker
    C++写日志方法调试
  • 原文地址:https://www.cnblogs.com/ukzq/p/13285159.html
Copyright © 2011-2022 走看看